社区讨论

WA0分,求助

P11229[CSP-J 2024] 小木棍参与者 3已保存回复 10

讨论操作

快速查看讨论及其快照的属性,并进行相关操作。

当前回复
8 条
当前快照
1 份
快照标识符
@m60ivsut
此快照首次捕获于
2025/01/17 16:53
去年
此快照最后确认于
2025/11/04 11:26
4 个月前
查看原帖
CPP
#include<bits/stdc++.h>
using namespace std;

long long t,n,cnt;
string s;

void speed() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
}

int main() {
	speed();
	cin>>t;
	while(t--) {
		cin>>n;
		if(n<7) {
			if(n==1)printf("%d\n",-1);
			else if(n==2)printf("%d\n",1);
			else if(n==3)printf("%d\n",7);
			else if(n==4)printf("%d\n",4);
			else if(n==5)printf("%d\n",2);
			else if(n==6)printf("%d\n",6);
			continue;
		}
		cnt=n%7;
		int k=n/7;
		if(cnt==1) {
			k--;
			printf("%d",10);
		} else if(cnt==2) {
			printf("%d",1);
		} else if(cnt==3) {
			if(n==10) {
				k=0;
				printf("%d",22);
			} else {
				k-=2;
				printf("%d",200);
			}
		} else if(cnt==4) {
			k--;
			printf("%d",20);
		} else if(cnt==5) {
			printf("%d",2);
		} else if(cnt==6) {
			printf("%d",6);
		}
		while(k--) {
			printf("%d",8);
		}
		cout<<endl;
	}
	return 0;
}

回复

10 条回复,欢迎继续交流。

正在加载回复...