結果
問題 |
No.176 2種類の切手
|
ユーザー |
![]() |
提出日時 | 2015-04-03 13:44:39 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 796 bytes |
コンパイル時間 | 2,646 ms |
コンパイル使用メモリ | 75,260 KB |
実行使用メモリ | 52,016 KB |
最終ジャッジ日時 | 2024-10-08 03:02:02 |
合計ジャッジ時間 | 5,282 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 WA * 4 |
ソースコード
import java.io.IOException; public class Main { public static void main(String[] args) { int A = nextInt(); int B = nextInt(); int T = nextInt(); long min = Long.MAX_VALUE; for (int i = 0; B * i <= T && i <= A; i++) { long next = B * i + (T - B * i) / A * A; if (next < T) { next += A; } min = Math.min(min, next); } System.out.println(min); } static int nextInt() { int c; try { c = System.in.read(); while (c != '-' && (c < '0' || c > '9')) c = System.in.read(); if (c == '-') return -nextInt(); int res = 0; while (c >= '0' && c <= '9') { res = res * 10 + c - '0'; c = System.in.read(); } return res; } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return -1; } }