結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
kenkoooo
|
| 提出日時 | 2015-04-03 13:49:30 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 1,000 ms |
| コード長 | 803 bytes |
| コンパイル時間 | 2,384 ms |
| コンパイル使用メモリ | 74,628 KB |
| 実行使用メモリ | 50,100 KB |
| 最終ジャッジ日時 | 2024-10-08 03:02:24 |
| 合計ジャッジ時間 | 5,333 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
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;; i++) {
int j = (T - B * i + A - 1) / A;
long next = B * i + A * j;
min = Math.min(min, next);
if (B * i > T || i > A) {
break;
}
}
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;
}
}
kenkoooo