poj 1426 Find The Multiple
2015-02-02 00:15
447 查看
灰常水的搜索。 == 因为数据太弱unsigned int64足够存的下答案。。从1dfs下去就行了
#include <iostream> #include <string> #include <algorithm> #include <set> #include <stdio.h> #include <string.h> using namespace std; bool OK; typedef unsigned __int64 ll; ll n; void dfs( ll now, int k) { //cout << " now : " << now << endl; if( OK ) return; if( now % n == 0 ) { cout << now << endl; OK = 1; return; } if( k == 19 ) return; dfs( now * 10 + 1, k + 1 ); dfs( now * 10, k + 1 ); } int main() { while( cin >> n && n) { OK = 0; dfs( 1, 0 ); } return 0; }
相关文章推荐
- POJ 1426, Find The Multiple
- poj 1426 Find The Multiple
- POJ1426-Find The Multiple
- POJ-1426 Find The Multiple
- POJ 1426 Find The Multiple(打表)
- POJ1426 Find The Multiple
- POJ1426 Find The Multiple 解题报告
- poj 1426 Find The Multiple
- POJ 1426 Find The Multiple (附模运算公式)
- Poj 1426 Find The Multiple
- POJ1426,Find The Multiple,bfs...注意类型 5兆内存过了...
- POJ 1426 Find The Multiple
- POJ1426-Find The Multiple
- POJ 1426 Find the Multiple
- POJ_1426_Find The Multiple
- POJ 1426 Find The Multiple
- poj -- 1426 Find The Multiple (搜索)
- POJ 1426 Find The Multiple
- POJ 1426 Find The Multiple
- poj 1426 Find The Multiple (广搜)