- 分享
为什么过不了??糖果游戏
- 2024-1-1 12:21:41 @
#include <bits/stdc++.h> using namespace std;
int main() { int a1,a2,a3,a4,a5; cin>>a1>>a2>>a3>>a4>>a5; a2=a2+a1/3; a5=a5+a1/3; a1=a1/3;
a1=a1+a2/3;
a3=a3+a2/3;
a2=a2/3;
a2=a2+a3/3;
a4=a4+a3/3;
a3=a3/3;
a3=a3+a4/3;
a5=a5+a4/3;
a4=a4/3;
a4=a4+a5/3;
a1=a1+a5/3;
a5=a5/3;
cout<<" "<<a1;
cout<<" "<<a2;
cout<<" "<<a3;
cout<<" "<<a4;
cout<<" "<<a5;
return 0;
}
6 comments
-
经开一中2026届11班关泽瑞 LV 6 @ 2024-1-2 20:53:00
你的代码太丑了。😊
-
2024-1-2 18:40:09@
printf控制输出宽度
-
2024-1-2 18:38:30@
#include <bits/stdc++.h> using namespace std; int main() { int a , b , c , d , e ; cin>> a >> b >> c >> d >> e ; a = ( a - a % 3 )/3 ,e = e + a,b = b + a ; b = ( b - b % 3 )/3 ,a = a + b,c = c + b ; c = ( c - c % 3 )/3 ,b = b + c,d = d + c ; d = ( d - d % 3 )/3 ,c = c + d,e = e + d ; e = ( e - e % 3 )/3 ,d = d + e,a = a + e ; printf("%5d",a); printf("%5d",b); printf("%5d",c); printf("%5d",d); printf("%5d",e); return 0; }
-
2024-1-1 21:48:23@
#include<bits/stdc++.h> using namespace std; int main() { int a, b, c, d, e; cin >> a >> b >> c >> d >> e; a = a / 3; e += a; b += a; b = b / 3; a += b; c += b; c = c / 3; b += c; d += c; d = d / 3; e += d; c += d; e = e / 3; a += e; d += e; cout << setw(5) << a << setw(5) << b << setw(5) << c << setw(5) << d << setw(5) << e; return 0; }
-
2024-1-1 21:48:12@
-
2024-1-1 21:47:15@
Emm
- 1