只过了第二个点,大佬求助
查看原帖
只过了第二个点,大佬求助
288506
OutsideR_楼主2020/8/7 12:31
#include <iostream>
using namespace std;
int main(){
	int x,c=0;
	long long ans;
	cin>>x;
	if(x<2){
		cout<<0<<endl;
		return 0;
	}
	if(x==2){
		cout<<2<<endl;
		cout<<1<<endl;
		return 0;
	}
	int time_ans=0;
	while(1){
		c++;
		int times=0;
		for(int i=1;i<=c;i++){
			if(c%i==0){
				times++;
			}
		}
		if(times==2){
			if(ans>x){
				cout<<time_ans;
				break;
			}
			else{
				ans=ans+c;
				cout<<c<<endl;
				time_ans++;
			}
		}	
	}
} 

为什么??? 电脑上都对的啊

2020/8/7 12:31
加载中...