|
|
|
|
讨论 Discussion |
|
| |
|
|
|
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("p1460.in","r",stdin);
freopen("p1460.out","w",stdout);
int n,i,a,b,c;
cin>>n;
a=n%10;
b=n/10%10;
c=n/100;
if(a*a*a+b*b*b+c*c*c==n)cout<<"yes";
else cout<<"no";
fclose(stdin);
fclose(stdout);
return 0;
}
( )
|
|
#include<bits/stdc++.h>
using namespace std;
int main(){
freopen("p1051.in","r",stdin);
freopen("p1051.out","w",stdout);
int n,m,a[1001]={0},k=1,c[1001]={0};
bool b=false;
cin>>n>>m;
for(int i=1;i<=n;i++){
cin>>a[i];
if(a[i]>m)k++;
}
cout<<k;
fclose(stdin);
fclose(stdout);
return 0;
}
( )
|
|
#include<bits/stdc++.h>
using namespace std;
int n;
int a[100];
int l=0;
void f(int s,int t) {
if(s==n){
for (int i=0;i<l;++i) {
if (i>0) {
cout << "+";
}
cout << a[i];
}
cout << endl;
return;
}
for (int i =t;s+i<=n;++i) {
a[l++]=i;
f(s+i, i);
l--;
}
}
int main() {
cin >> n;
f(0, 1);
return 0;
}
( )
|
|
#include<bits/stdc++.h>
using namespace std;
bool f(int m) {
if (m<2) return false;
for (int i = 2; i <= sqrt(m); ++i) {
if (m % i == 0) {
return false;
}
}
return true;
}
int main() {
freopen("p1049.in","r",stdin);
freopen("p1049.out","w",stdout);
int n;
cin>>n;
int count=0;
int num=2;
while (true) {
if (f(num)) {
count++;
if (count == n) {
cout <<num;
break;
}
}
num++;
}
fclose(stdin);
fclose(stdout);
return 0;
}
( )
|
|
|
|
|
|
|
|
|
|
Flag |
|
题号 |
P1608 |
|
其它 |
通过 |
35人 |
提交 |
91次 |
通过率 |
38% |
难度 |
0 |
|
|
|
|
|
|