結果

問題 No.397 NO MORE KADOMATSU
ユーザー newlife171128
提出日時 2018-01-16 23:39:52
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 798 ms
コンパイル使用メモリ 81,556 KB
実行使用メモリ 24,964 KB
平均クエリ数 0.39
最終ジャッジ日時 2024-07-16 15:23:15
合計ジャッジ時間 4,593 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 WA * 1 TLE * 1 -- * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>

typedef long long ll;

using namespace std;

int kadomatsu[101];

int main() {

	int m=0;
	cin>>m;

	for(int i=0; i<m;i++){
		int tmp=0;
		cin>>tmp;
		kadomatsu[i] = tmp;
	}

	bool judge = true;

	int a=0;

	while(judge){

		judge = false;

		for(int i=0; i<m-1; i++){
			if(kadomatsu[i] > kadomatsu[i+1]){
				int tmp = kadomatsu[i];
				kadomatsu[i] = kadomatsu[i+1];
				kadomatsu[i+1] = tmp;

				judge = true;
				a++;

				cout<<i<<" "<<i+1<<endl;
			}
		}

	}
	int b;
	cin>>b;

	if(a ==0){
		cout<<0<<endl;
	}

	return 0;
}
0