/* * uva10879 * Date:2014/5/7 * State:AC */ #include <iostream> #include <fstream> using namespace std; int main() { //cout << "Hello world!" << endl; //freopen("input.txt","r",stdin); int N; cin>>N; for(int i=0;i<N;i++) { int K; cin>>K; int counter=0; cout<<"Case #"<<i+1<<": "<<K; for(int i=2;i*i<K;i++) { if(K%i==0 && counter<2) { cout<<" = "<<i<<" * "<<K/i; counter++; } } cout<<endl; } //fclose(stdin); return 0; }
原文:http://blog.csdn.net/greenapple_shan/article/details/25338923