結果
| 問題 |
No.2091 Shio Ramen (Easy)
|
| ユーザー |
Maeda
|
| 提出日時 | 2025-03-19 17:57:48 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 375 bytes |
| コンパイル時間 | 399 ms |
| コンパイル使用メモリ | 24,704 KB |
| 実行使用メモリ | 7,324 KB |
| 最終ジャッジ日時 | 2025-03-19 17:57:49 |
| 合計ジャッジ時間 | 1,277 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:5:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
5 | scanf("%d %d %d",&n,&s,&k);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
main.c:10:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
10 | scanf("%d",&salt);
| ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h>
void main(void){
int n,s,k;
scanf("%d %d %d",&n,&s,&k);
int min = 10;
int store = -1;
int salt = 0;
for(int i = 0 ; i < n ; i++){
scanf("%d",&salt);
salt = salt - s;
if(salt < 0){
salt *= -1;
}
if(salt <= k && min > salt){
min = salt;
store = i;
}
}
if(store == -1){
printf("Unlucky!");
}else{
printf("%d",store+1);
}
}
Maeda