結果
| 問題 |
No.365 ジェンガソート
|
| コンテスト | |
| ユーザー |
akakimidori
|
| 提出日時 | 2016-12-11 20:50:38 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 11 ms / 2,000 ms |
| コード長 | 365 bytes |
| コンパイル時間 | 121 ms |
| コンパイル使用メモリ | 21,120 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-11-29 03:57:32 |
| 合計ジャッジ時間 | 1,477 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 41 |
コンパイルメッセージ
main.c: In function ‘run’:
main.c:6:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
6 | scanf("%d",&n);
| ^~~~~~~~~~~~~~
main.c:11:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",a+i);
| ^~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<stdlib.h>
void run(void){
int n;
scanf("%d",&n);
int *a=(int *)malloc(sizeof(int)*n);
int t=n-1;
int i;
for(i=0;i<n;i++){
scanf("%d",a+i);
if(a[i]==n)
t=i-1;
}
int c=1;
while(t>=0){
if(a[t]==n-c){
c++;
}
t--;
}
printf("%d\n",n-c);
return;
}
int main(void){
run();
return 0;
}
akakimidori