結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
TLwiegehtt
|
| 提出日時 | 2015-07-19 22:28:37 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 514 bytes |
| コンパイル時間 | 125 ms |
| コンパイル使用メモリ | 24,704 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 03:28:54 |
| 合計ジャッジ時間 | 1,130 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 22 WA * 7 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:14:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d %d %d", &A,&B, &T);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <math.h>
#include <string.h>
#include <stdio.h>
int min(int a, int b){
if(a<b){return a;}
return b;
}
int main(void){
int A,B,T;
int ans;
scanf("%d %d %d", &A,&B, &T);
if(T%A == 0 || T%B == 0){
ans = T;
}else{
int x;
ans = min((T/A + 1) * A, (T/B + 1) * B);
for(x=1;x<(T/A+1);x++){
int y = ceil((1.0 * T- A * x) / B);
int tmp = A*x+B*y;
if(ans < tmp){
break;
}
if( T <= tmp && tmp <= ans ){
ans = tmp;
}
}
}
printf("%d\n", ans);
return 0;
}
TLwiegehtt