結果
問題 | No.604 誕生日のお小遣い |
ユーザー | mban |
提出日時 | 2017-12-15 16:48:48 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,646 bytes |
コンパイル時間 | 1,204 ms |
コンパイル使用メモリ | 107,264 KB |
実行使用メモリ | 18,176 KB |
最終ジャッジ日時 | 2024-05-08 12:13:42 |
合計ジャッジ時間 | 2,259 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 24 ms
17,920 KB |
testcase_01 | AC | 25 ms
17,920 KB |
testcase_02 | AC | 24 ms
17,920 KB |
testcase_03 | AC | 25 ms
18,176 KB |
testcase_04 | AC | 24 ms
17,792 KB |
testcase_05 | AC | 24 ms
17,792 KB |
testcase_06 | AC | 24 ms
17,920 KB |
testcase_07 | AC | 25 ms
17,664 KB |
testcase_08 | AC | 25 ms
17,664 KB |
testcase_09 | AC | 25 ms
17,920 KB |
testcase_10 | AC | 24 ms
17,920 KB |
testcase_11 | AC | 24 ms
17,664 KB |
testcase_12 | WA | - |
testcase_13 | AC | 25 ms
17,664 KB |
testcase_14 | AC | 25 ms
17,920 KB |
testcase_15 | AC | 25 ms
18,048 KB |
testcase_16 | AC | 24 ms
17,920 KB |
testcase_17 | AC | 25 ms
18,048 KB |
testcase_18 | AC | 25 ms
17,792 KB |
testcase_19 | AC | 24 ms
18,048 KB |
testcase_20 | AC | 25 ms
17,792 KB |
testcase_21 | AC | 24 ms
17,792 KB |
testcase_22 | AC | 26 ms
17,792 KB |
testcase_23 | AC | 26 ms
17,792 KB |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Scanner { private readonly char Separator = ' '; private int Index = 0; private string[] Line = new string[0]; public string Next() { if (Index >= Line.Length) { Line = Console.ReadLine().Split(Separator); Index = 0; } var ret = Line[Index]; Index++; return ret; } public int NextInt() { return int.Parse(Next()); } public long NextLong() { return long.Parse(Next()); } public string[] StringArray() { Line = Console.ReadLine().Split(Separator); Index = Line.Length; return Line; } public int[] IntArray() { var l = StringArray(); var res = new int[l.Length]; for (int i = 0; i < l.Length; i++) { res[i] = int.Parse(l[i]); } return res; } public long[] LongArray() { var l = StringArray(); var res = new long[l.Length]; for (int i = 0; i < l.Length; i++) { res[i] = long.Parse(l[i]); } return res; } } struct S { public int Begin, End, Length; public S(int b, int e) { Begin = b; End = e; Length = e - b + 1; } } class SegmentTree<T> { private T[] Array; private readonly int N; private Comparison<T> Comparison; private readonly T Min; public SegmentTree(int length, T min) : this(length, min, Comparer<T>.Default) { } public SegmentTree(int length, T min, IComparer<T> comparer) : this(length, min, comparer.Compare) { } public SegmentTree(int length, T min, Comparison<T> comparison) { for (N = 1; N < length; N *= 2) ; Array = new T[N * 2]; Min = min; for (int i = 1; i < N * 2; i++) { Array[i] = Min; } Comparison = comparison; } private T Max(T a, T b) { if (Comparison(a, b) >= 0) { return a; } else { return b; } } public void Update(int index, T value) { index += N; Array[index] = value; for (index = index / 2; index > 0; index /= 2) { Array[index] = Max(Array[index * 2], Array[index * 2 + 1]); } } private T Query(int a, int b, int k, int l, int r) { if (a <= l && r <= b) { return Array[k]; } if (b <= l || r <= a) { return Min; } T left = Query(a, b, k * 2, l, (l + r) / 2); T right = Query(a, b, k * 2 + 1, (l + r) / 2, r); return Max(left, right); } public T Query(int a, int b) { return Query(a, b, 1, 0, N); } } class Program { private long A, B, C; private void Scan() { var sc = new Scanner(); A = sc.NextLong(); B = sc.NextLong(); C = sc.NextLong(); } public void Solve() { Scan(); long min = 0; long max = (C + B - 1) / B * A; while (max - min > 1) { long mid = (min + max) / 2; if (F(mid) >= C) { max = mid; } else { min = mid; } } Console.WriteLine(max); } public long F(long y) { return y + ((y / A) * (B - 1)); } static void Main(string[] args) { new Program().Solve(); } }