Topic: http://codeforces.com/contest/260/problem/A
Ideas: a% b == 0 => a * 10 ^ n% b == 0
This problem initially ignored the sentence If there are multiple possible answers, print any of them.
Like a long time I think the answer is more than one ah
Then see n ranges to know that this problem can not be considered a bit
#include <iostream> #include <cstdlib> using namespace std; int a,b,n; int main() { cin >> a>>b>>n; a*=10; int flag=0; for(int i=0;i<10;i++) { if(a%b==0) { flag=1; break; } a++; } if(flag) { cout << a; for(int i=0;i<n-1;i++) { cout<<"0"; } cout << endl; } else { cout << "-1"<<endl; } return 0; }
Reproduced in: https: //www.cnblogs.com/danielqiu/archive/2013/01/16/2863078.html