結果
問題 | No.2194 兄弟の掛け引き |
ユーザー |
👑 ![]() |
提出日時 | 2023-03-08 19:01:31 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 55 ms / 1,000 ms |
コード長 | 1,654 bytes |
コンパイル時間 | 6,396 ms |
コンパイル使用メモリ | 167,776 KB |
実行使用メモリ | 186,080 KB |
最終ジャッジ日時 | 2024-09-18 02:38:25 |
合計ジャッジ時間 | 8,085 ms |
ジャッジサーバーID (参考情報) |
judge6 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (84 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;using System.Linq;class Scanner{string[] s;int i;char[] cs = new char[] { ' ' };public Scanner(){s = new string[0];i = 0;}public string Next(){if (i < s.Length) return s[i++];string st = Console.ReadLine();while (st == "") st = Console.ReadLine();s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);if (s.Length == 0) return Next();i = 0;return s[i++];}public int NextInt(){return int.Parse(Next());}public long NextLong(){return long.Parse(Next());}}class Program{static void Main(string[] args){// Commentvar scanner = new Scanner();long A = scanner.NextLong();long B = scanner.NextLong();long C = scanner.NextLong();bool exist = false;for (long i = 1 ; i < 1000000 ; i++){long X = A * i;if (X-B > 0) X -= B;if (X == C){Console.WriteLine(i);exist = true;}}if (!exist){Console.WriteLine(-1);}/*for (int lp = 0 ; lp < T ; lp++){int[] li = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();int L = li[0];int R = li[1];int A = li[2];int B = li[3];int ans;if ( A*L+B > A*R+B ){ans = A*L+B;}else{ans = A*R+B;}Console.WriteLine(ans);}*/}}