QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#346849#5528. Least Annoying Constructive Problemucup-team134WA 1ms3736kbC++17518b2024-03-09 03:03:402024-03-09 03:03:41

Judging History

你现在查看的是最新测评结果

  • [2024-03-09 03:03:41]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3736kb
  • [2024-03-09 03:03:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int n;
int add(int a,int b){
	a+=b;
	a%=n;
	if(a<0)a+=n;
	if(a==0)a=n;
	return a;
}
int main(){
	scanf("%i",&n);
	if(n%2==1){
		for(int i=1;i<=n;i++){
			for(int j=0;j<n/2;j++){
				printf("%i %i\n",add(i,-j),add(i,j+1));
			}
		}
	}else{
		for(int i=1;i<=n/2;i++){
			for(int j=0;j<n/2;j++){
				printf("%i %i\n",add(i,-j),add(i,j+1));
			}
			for(int j=0;j<n/2-1;j++){
				printf("%i %i\n",add(i,-j),add(i,j+2));
			}
		}
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3736kb

input:

3

output:

1 2
2 3
3 1

result:

wrong answer Integer 1 violates the range [4, 3]