結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-29 18:56:16 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 5,000 ms |
| コード長 | 471 bytes |
| コンパイル時間 | 389 ms |
| コンパイル使用メモリ | 55,684 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-09-14 05:11:44 |
| 合計ジャッジ時間 | 1,216 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:23:11: warning: ‘total’ may be used uninitialized in this function [-Wmaybe-uninitialized]
23 | (total/(n-1)==2) ? cout << n << " 0\n" : cout << 0 << " " << n << "\n";
| ~~~~~^~~~~~
ソースコード
#include <iostream>
using namespace std;
int main(){
int n, input, total;
int bSame=1;
cin >> n;
for(int i=0; i<n; ++i){
cin >> input;
if(i==0) total=input;
else{
if(total==input) continue;
else{
total += ((total<input) ? 4 : 2);
bSame=0;
break;
}
}
}
if(bSame==0) cout << 2*n-total/2 << " " << total/2-n << "\n";
else{
(total/(n-1)==2) ? cout << n << " 0\n" : cout << 0 << " " << n << "\n";
}
return 0;
}