結果
| 問題 |
No.1893 Cycle
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-04-29 15:30:41 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
AC
|
| 実行時間 | 53 ms / 2,000 ms |
| コード長 | 1,435 bytes |
| コンパイル時間 | 7,498 ms |
| コンパイル使用メモリ | 171,428 KB |
| 実行使用メモリ | 188,092 KB |
| 最終ジャッジ日時 | 2024-06-28 22:08:29 |
| 合計ジャッジ時間 | 9,696 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (93 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 Practice1
{
class Program
{
static void Main(string[] args)
{
string nums = Console.ReadLine(); //標準入力を受け取り
string[] numsArray = nums.Split(" "); //空白文字で分割
int x = Convert.ToInt32(numsArray[0]); //一つ目の引数をintに変換
int y = Convert.ToInt32(numsArray[1]); //二つ目の引数をintに変換
int abs = Math.Abs(x - y); //チェック前絶対値
if(abs > 6) //周りこみ確認
{
abs = 12 - abs; //反対側から差を出す
}
//0-11で繰り返しチェック
for(int i =0; i < 12; i++)
{
if(i.Equals(x) || i.Equals(y))
{
continue; //iが引数のいずれかと等しいなら次へ
}
int absX = Math.Abs(i - x);
if (absX > 6) //周りこみ確認
{
absX = 12 - absX;
}
int absY = Math.Abs(i - y);
if(absY > 6) //周りこみ確認
{
absY = 12 - absY;
}
if (abs.Equals(absX) && abs.Equals(absY))
{
Console.WriteLine(i); //iを出力
}
}
}
}
}