結果
| 問題 | No.176 2種類の切手 |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-10-07 17:11:40 |
| 言語 | Java (openjdk 26.0.2.1) |
| 結果 |
AC
|
| 実行時間 | 383 ms / 1,000 ms |
| + 840µs | |
| コード長 | 633 bytes |
| 記録 | |
| コンパイル時間 | 1,500 ms |
| コンパイル使用メモリ | 84,576 KB |
| 実行使用メモリ | 43,472 KB |
| 最終ジャッジ日時 | 2026-08-19 10:17:38 |
| 合計ジャッジ時間 | 5,482 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 29 |
ソースコード
import java.util.*;
public class Main {
public static void main (String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int t = sc.nextInt();
if (t % a == 0 || t % b == 0) {
System.out.println(t);
return;
}
int count = 0;
int min = Integer.MAX_VALUE;
while (count * b < t) {
min = Math.min(min, (t - count * b + a - 1) / a * a + count * b);
if (min == t) {
System.out.println(t);
return;
}
count++;
}
min = Math.min(min, (t + b - 1) / b * b);
System.out.println(min);
}
}
tenten