Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
1015 | 关清声 | 求满足条件的3位数 | C++ | Wrong Answer | 0 MS | 256 KB | 524 | 2023-06-17 17:20:27 |
#include<bits/stdc++.h> using namespace std; int last(int x) { for(int i=10;i<=32;i++) { if(i*i==x) { return 1; } } return 0; } int number(int x) { int a=x%10; int b=x%100-a; int c=x-a-b; if(a==c||b==c||a==b) { return 1; } else { return 0; } } int main() { int n; cin>>n; int i=1; for(int l=100;l<=999;l++) { if(last(l)==1&&number(l)==1) { if(i==n) { cout<<l<<endl; return 0; } else { i++; } } } return 0; }
------Input------
2
------Answer-----
121
------Your output-----
400