結果
問題 | No.112 ややこしい鶴亀算 |
ユーザー |
![]() |
提出日時 | 2016-08-15 17:52:23 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 5,000 ms |
コード長 | 527 bytes |
コンパイル時間 | 400 ms |
コンパイル使用メモリ | 54,732 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-11-07 17:43:41 |
合計ジャッジ時間 | 1,165 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 23 |
ソースコード
#include <iostream> using namespace std; int main() { int N; int a[50]; int x = 0, y = 0; int count = 1; cin >> N; cin >> a[0]; x = a[0]; for (int i = 1; i < N;i++) { cin >> a[i]; if (x != a[i]) { y = a[i]; } else { count++; } } if (x == 0 || y == 0) { if (x == (N - 1) * 4) { cout << 0 << " " << N << endl; } else { cout << N << " " << 0 << endl; } return 0; } if (x >= y) { cout << count << " " << N - count << endl; } else { cout << N - count << " " << count << endl; } return 0; }