最恐怖的样例过了,但是全WA,心态崩了
查看原帖
最恐怖的样例过了,但是全WA,心态崩了
1070628
nyk1315楼主2024/7/3 20:53

(其实吧我觉得我代码挺正常的) 代码如下:

#include<bits/stdc++.h>
using namespace std;
int k,a[30000],c=1,abc,bcd,cde;//c:统计几个,a:统计数字 
void pd(int x){
	abc=(x-x%100)/100;
	bcd=(x%10000-x%10)/10;
	cde=x%1000;
	if(abc%15==0&&bcd%15==0&&cde%15==0)
		a[c]=x,c++;
}
int main(){
	cin>>k; 
	for(int t=10000;t<=30000;t++)
		pd(t);
	if(c==1)
		cout<<"No";
	else
		for(int i=1;i<c;i++)
			cout<<a[i]<<endl;
	return 0;
} 
2024/7/3 20:53
加载中...