結果
| 問題 |
No.176 2種類の切手
|
| コンテスト | |
| ユーザー |
nearwisteriaJP
|
| 提出日時 | 2015-04-05 23:22:47 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 461 bytes |
| コンパイル時間 | 387 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-10-08 03:09:43 |
| 合計ジャッジ時間 | 1,409 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 3 |
| other | RE * 29 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:25:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
25 | scanf("%d %d %d",&A,&B,&T);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
#include <stdlib.h>
#define MAX_T 1000000001
int memo[MAX_T];
int A,B,T;
#define min(a,b) (((a)>(b))?(b):(a))
int solve( int left){
if( left <= 0 ){
return -left;
}
if( memo[left] != -1 ){
return memo[left];
}
memo[left] = min( solve( left - A ), solve( left-B) );
return memo[left];
}
int main( void ){
int i;
scanf("%d %d %d",&A,&B,&T);
for(i=0;i<T+1;i++){ memo[i] = -1; }
printf("%d\n",solve(T)+T);
return 0;
}
nearwisteriaJP