結果

問題 No.397 NO MORE KADOMATSU
ユーザー newlife171128newlife171128
提出日時 2018-01-16 23:39:52
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 770 bytes
コンパイル時間 1,690 ms
コンパイル使用メモリ 81,240 KB
実行使用メモリ 24,444 KB
平均クエリ数 0.39
最終ジャッジ日時 2023-09-23 15:37:54
合計ジャッジ時間 5,333 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
権限があれば一括ダウンロードができます

ソースコード

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