結果
| 問題 |
No.112 ややこしい鶴亀算
|
| コンテスト | |
| ユーザー |
Adamantite
|
| 提出日時 | 2023-06-28 20:30:57 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 54 ms / 5,000 ms |
| コード長 | 1,008 bytes |
| コンパイル時間 | 14,809 ms |
| コンパイル使用メモリ | 168,540 KB |
| 実行使用メモリ | 183,892 KB |
| 最終ジャッジ日時 | 2024-07-05 13:51:20 |
| 合計ジャッジ時間 | 16,385 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (106 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System;
namespace No112_ComplicatedTsurukameCalculation
{
internal class Program
{
static void Main(string[] args) {
int n = int.Parse(Console.ReadLine());
int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x));
int total = array[0];
bool flg = true;
for(int i = 1; i < n; i++) {
if(array[i] != total) {
if(array[i] < total) {
total += 2;
} else {
total += 4;
}
flg = false;
break;
}
}
if(flg) {
if(total == 2 * (n - 1)) {
total += 2;
} else {
total += 4;
}
}
int diff = (total - 2 * n) / 2;
Console.WriteLine(string.Format("{0} {1}", n - diff, diff));
}
}
}
Adamantite