題目:?http://codeforces.com/contest/260/problem/A
思路:a%b==0 => a*10^n%b==0
這題一開始忽略了一句話??If there are multiple possible answers, print any of them.
code1083,想了半天覺得答案不只一種啊
然后看到n的范圍就知道這題不可能一位位算
#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; }
?