poj 1426Find The Multiple
這真是超神奇的一道題目!樣例沒過,照樣ACCEPTED,看來我人品爆了。呵呵呵。。。本人還是覺得是樣例有問題的!
題目意思超簡單:找到任意n的倍數m,但是m由十進位制0,1組成。直接BFS。
程式碼:
#include<iostream>
using namespace std;
__int64 q[9999999];
int n;
void bfs()
{
int front,rear;
front=rear=0;
q[rear]=1;
rear++;
__int64 top;
while(front<rear)
{
top=q[front];
if(top%n==0){cout<<top<<endl;break;}
top*=10;
q[rear]=top;
rear++;
q[rear]=top+1;
front++;
rear++;
}
}
int main()
{
while(cin>>n,n)
{
bfs();
}
return 0;
}
相關文章
- POJ1426-Find The Multiple
- POJ 1465-Multiple(BFS-最小整倍數)
- Multiple Regression
- JavaScript select multipleJavaScript
- Small Multiple(最短路)
- DataGridView with multiple tableView
- Multiple Buffer Pools (83)
- Multiple Block Sizes (53)BloC
- 2.3.6.2 Synchronization of Multiple ApplicationsAPP
- Multiple Books多賬薄
- Multiple Render Targets in OpenGL with Cg
- MySql multiple servers on linuxMySqlServerLinux
- ssis multiple table to one file
- maven Multiple sourceDirectory外掛Maven
- Using Multiple Tablespaces (46)
- LLM multiple modal applicationsAPP
- android-Maintaining Multiple APKs,Creating Multiple APKs for Different API LevelsAndroidAIAPKAPI
- Logstash Multiple Pipelines
- kubernetes traefik multiple namespacesnamespace
- Using Multiple Variables with the Same Name
- How to modify multiple items in the SAP menu
- POJ 3461 kmpKMP
- poj3417
- win10版本multiple editions是什麼版本_win10版本multiple editions啥意思Win10
- HDU 6298 Maximum Multiple(找規律)
- Entity Framework Tutorial Basics(41):Multiple DiagramsFramework
- 6.6 多文件介面(Multiple Document Interface)
- EF:split your EDMX file into multiple diagrams
- android-Creating Multiple APKs for Different Screen Sizes,Creating Multiple APKs for Different GL TeAndroidAPK
- Flip Game(POJ 1753)GAM
- POJ 2431 Expedition
- POJ 3414 Pots
- POJ3259-WormholesWorm
- Adobe reader multiple languages pack
- input file multiple 批量上傳檔案
- Page directive must not have multiple occurrences of pageencodingEncoding
- Delete multiple git remote branches by prefixing colondeleteGitREM
- SQLite Learning、SQL Query Optimization In Multiple RuleSQLite