POJ 2882 Problem I

时间限制: 
1000ms
内存限制: 
65536kB
描述
输入整数a和b,如果a能被b整除,就输出算式的商,否则输出整数商和余数,如果b=0,输出error。
输入
整数a和整数b
输出
商或者商和余数或者error
样例输入
100 1075 201 0
样例输出
103 15error
 
(1)、源代码:
#include <iostream>
using namespace std;
 
int main(){
                int s, t, a, b;
 
                while(cin >> a >> b){
                                if(0 == b)
                                                cout << "error\n";
                                else if(a%b)
                                                cout << a/b << " " << a%b << endl;
                                else
                                                cout << a/b << endl;
                }
}
  
(2)、解题思路:略
(3)、可能出错:略
posted on 2012-05-11 20:13  谷堆旁边  阅读(434)  评论(0编辑  收藏  举报