UVA 10879

#include<iostream>
using namespace std;
int main()
{
    int sum,flag=1;
    cin>>sum;
    while(sum--)
    {
        long long n,i=2;
        cin>>n;
        cout<<"Case #"<<flag++<<": "<<n<<" = ";
        int flag2=1;
        while(true)
        {
            if(n%i==0&&flag2==1)
            {
                cout<<i<<" * "<<n/i<<" = ";
                flag2++;
                i++;
            }
            if(n%i==0&&flag2==2)
            {
                cout<<i<<" * "<<n/i<<endl;
                break;
            }
            i++;
        }
    }
    return 0;
}

 

posted @ 2012-04-28 12:16  open your eyes  阅读(146)  评论(0编辑  收藏  举报