結果
| 問題 |
No.604 誕生日のお小遣い
|
| コンテスト | |
| ユーザー |
mban
|
| 提出日時 | 2017-12-15 16:45:58 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 3,641 bytes |
| コンパイル時間 | 924 ms |
| コンパイル使用メモリ | 114,388 KB |
| 実行使用メモリ | 26,132 KB |
| 最終ジャッジ日時 | 2024-12-14 15:57:05 |
| 合計ジャッジ時間 | 2,439 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 9 |
コンパイルメッセージ
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 = (long)1e18 + 1;
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();
}
}
mban