結果
| 問題 | No.365 ジェンガソート | 
| コンテスト | |
| ユーザー |  Lay_ec | 
| 提出日時 | 2016-04-29 23:48:15 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 545 bytes | 
| コンパイル時間 | 541 ms | 
| コンパイル使用メモリ | 79,312 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-04 19:29:46 | 
| 合計ジャッジ時間 | 2,084 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 16 WA * 25 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   32 |                 scanf("%d",&a);
      |                 ~~~~~^~~~~~~~~
            
            ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>
using namespace std;
const long long mod=1000000007; 
int main()
{
	int n;
	cin>>n;
	int x;
	cin>>x;
	int rest=x-1;
	
	int res=0;
	for(int i=1;i<n;i++){
		int a;
		scanf("%d",&a);
		if(rest==0) x=a,rest=x-1;
		else if(x>a){
			res++;
			rest--;
		}
	}
	cout<<res<<endl;
    return 0;
}
            
            
            
        