Codeforces Round #567 (Div. 2) A.Chunga-Changa

原文链接:传送

 1 #include"algorithm"
 2 #include"iostream"
 3 #include"cmath"
 4 using namespace std;
 5 long long x,y,z,ans;
 6 int main(){
 7     while(cin>>x>>y>>z){
 8        ans=0;
 9        long long s=0,i=0,j=0;
10        s=(x+y)/z;
11        cout<<s<<" ";
12        i=x%z;
13        j=y%z;
14     if((i+j)>=z){
15         if(i>j) cout<<z-i<<endl;
16         else cout<<z-j<<endl;
17     }
18     else {
19         cout<<0<<endl;
20     }
21     
22     }
23     return 0;    
24     
25 }

猜你喜欢

转载自www.cnblogs.com/huangdf/p/12222440.html