Submission #00007
ソースコード
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | #include<bits/stdc++.h> using namespace std; #define endl "\n" #define ll long long #define fix(ans,x) fixed << setprecision(x)<<(double)ans #define total(n) n*(n+1)/2 int main(){ vector< int > a(4); int j=0; int b[4]={}; bool flag= true ; while (flag){ int ans=0; for ( int i=0;i<4;i++){ cin>>a[i]; ans+=a[i]; } if (ans==0){ flag= false ; } else { bool flog= true ; while (flog){ sort(a.begin(),a.end()); if (a[0]==0&&a[1]==0&&a[2]==0){ b[j]=a[3]; flog= false ; j++; } else { // 4 6 8 10 int s=0; for ( int i=0;i<4;i++){ if (a[i]!=0){ s=i; i=4; } } for ( int i=s+1;i<4;i++){ a[i]-=a[s]; } } //cout<<a[0]<<" "<<a[1]<<" "<<a[2]<<" "<<a[3]<<endl; } } } for ( int i=0;i<4;i++){ cout<<b[i]<<endl; } } |
ステータス
項目 | データ |
---|---|
問題 | 0002 - ビー玉占い |
ユーザー名 | ei2132 |
投稿日時 | 2022-04-22 16:36:29 |
言語 | C++17 |
状態 | Runtime Error |
得点 | 0 |
ソースコード長 | 1244 Byte |
最大実行時間 | 58 ms |
最大メモリ使用量 | 604 KB |
セット
セット | 得点 | Cases | |
---|---|---|---|
1 | A1 | 0 / 3 | A1 |
2 | A2 | 0 / 3 | A2 |
3 | A3 | 0 / 3 | A3 |
4 | A4 | 0 / 3 | A4 |
テストケース
ファイル名 | 状態 | 実行時間 | メモリ使用量 | # | |||
---|---|---|---|---|---|---|---|
A1 | RE | 58 ms | 604 KB |
1
|
|||
A2 | RE | 37 ms | 572 KB |
2
|
|||
A3 | RE | 24 ms | 412 KB |
3
|
|||
A4 | RE | 23 ms | 508 KB |
4
|