結果
| 問題 | No.112 ややこしい鶴亀算 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-11-29 18:56:16 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| + 343µs | |
| コード長 | 471 bytes |
| 記録 | |
| コンパイル時間 | 265 ms |
| コンパイル使用メモリ | 69,632 KB |
| 実行使用メモリ | 6,272 KB |
| 最終ジャッジ日時 | 2026-08-26 20:31:13 |
| 合計ジャッジ時間 | 1,879 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:23:11: warning: 'total' may be used uninitialized [-Wmaybe-uninitialized]
23 | (total/(n-1)==2) ? cout << n << " 0\n" : cout << 0 << " " << n << "\n";
| ~~~~~^~~~~~
main.cpp:5:17: note: 'total' was declared here
5 | int n, input, total;
| ^~~~~
ソースコード
#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;
}