求求啦 openjudge
  • 板块题目总版
  • 楼主chenjialin
  • 当前回复8
  • 已保存回复8
  • 发布时间2021/11/17 22:42
  • 上次更新2023/11/4 00:17:34
查看原帖
求求啦 openjudge
540944
chenjialin楼主2021/11/17 22:42

测试点全过(自测)

但全wa

题目网址

#include<bits/stdc++.h>
using namespace std;
bool pf(int x){
	if(x<4) return false;
	for(int i=1;i*i<=x;i++){
		if(x%i==0&&x==i*i) return true;
	}
	return false;
}
bool erwei(int x){
	int a,b,c;
	a=x%100;
	b=x/10%10;
	c=x/100;
	if(a==b||a==c||b==c) return true;
	return false;
}
int main()
{
	int n,cnt=0;
	cin>>n;
	for(int j=100;j<=999;j++){
		if(pf(j)&&erwei(j)) cnt++;
		if(cnt==n){
		cout<<j;return 0;	
		}
	}

 	return 0;
}


2021/11/17 22:42
加载中...