第三个测试点不过
查看原帖
第三个测试点不过
648641
lanzhijie525楼主2022/4/2 16:16

改了好久,就是第三个测试点不会过

求解!!!!

#include<iostream>
using namespace std;
int main(){
	int n,cnt=0;cin>>n;
	if(n%3==0){
		cout<<"3";
		cnt++;
	}
	if(n%5==0){
		if(cnt=0) cout<<"5";
		else cout<<" "<<"5";
		cnt++;
	}
	if(n%7==0){
		if(cnt=0) cout<<"7";
		else cout<<" "<<"7";
		cnt++;
	}
	if(cnt==0) cout<<"n"<<endl;
	return 0;
}
2022/4/2 16:16
加载中...