結果
問題 | No.176 2種類の切手 |
ユーザー |
![]() |
提出日時 | 2015-07-20 02:11:15 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 1,000 ms |
コード長 | 407 bytes |
コンパイル時間 | 571 ms |
コンパイル使用メモリ | 21,248 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-08 03:29:40 |
合計ジャッジ時間 | 1,057 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 7 | scanf("%lld %lld %lld", &A,&B,&T); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <string.h>#include <stdio.h>int main(void){long long int A,B,T,x,y,ans = 9999999999;scanf("%lld %lld %lld", &A,&B,&T);for(y=0;y<=T;y++){long long int tmp;x = (T-B*y+A-1)/A;tmp = A*x + B*y;if( x < 0){break;}if( A < y){break;}if(T <= tmp && tmp <= ans){ans = tmp;if(ans == T){break;}}}printf("%lld\n", ans);return 0;}