1 条题解
-
0
C++ :
#include<iostream> using namespace std; int main() { int a,b,c,s,e,d; cin>>a>>b>>c; if (a>b) { s=(c+(a-b))/2; e=a-s; d=b-e; cout<<"red"<<":"<<s<<" "<<"blue"<<":"<<e<<" "<<"yellow"<<":"<<d<<endl; } else if (b>a) { s=(c+(b-a))/2; e=b-s; d=a-e; cout<<"red"<<":"<<d<<" "<<"blue"<<":"<<e<<" "<<"yellow"<<":"<<s<<endl; } return 0; }
Pascal :
var n,m,k,a,b,c:longint; begin readln(n,m,k); a:=(n+k-m) div 2; b:=n-a; c:=k-a; writeln('red:',a,' blue:',b,' yellow:',c); end.
- 1
信息
- ID
- 748
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者