8 条题解
-
2
#include<bits/stdc++.h> using namespace std; int main(){ int n; scanf("%d",&n); for(int i=1;i<=n;i++){ int sum=0; for(int j=1;j<i;j++){ if(i%j0){ sum+=j; } } if(sumi){ printf("%d its factors are ",i); for(int q=1;q<i;q++){ if(i%q==0){ printf("%d ",q); } } printf("\n"); } } return 0; }
-
2
#include<bits/stdc++.h> using namespace std; int main(){ int n,i,j,sum; scanf("%d",&n); for(i=1;i<=n;i++){ sum=0; for(j=1;j<i;j++){ if(i%j==0){ sum+=j; } } if(sum==i){ printf("%d its factors are ",i); for(j=1;j<i;j++){ if(i%j==0){ printf("%d ",j); } } printf("\n"); } } return 0; }
-
-1
```#include<bits/stdc++.h> using namespace std; int man(){ int a; cin>>a; if(a>=6 and a<28) cout<<"6 its factors are 1 2 3"; if(a>=28 and a<496) cout<<"6 its factors are 1 2 3"<<endl<<"28 its factors are 1 2 4 7 14"; if(a>=496) cout<<"6 its factors are 1 2 3"<<endl<<"28 its factors are 1 2 4 7 14"<<endl<<"496 its factors are 1 2 4 8 16 31 62 124 248"; return 0;
-
-2
#include<bits/stdc++.h> using namespace std; int man(){ int a; cin>>a; if(a>=6 and a<28) cout<<"6 its factors are 1 2 3"; if(a>=28 and a<496) cout<<"6 its factors are 1 2 3"<<endl<<"28 its factors are 1 2 4 7 14"; if(a>=496) cout<<"6 its factors are 1 2 3"<<endl<<"28 its factors are 1 2 4 7 14"<<endl<<"496 its factors are 1 2 4 8 16 31 62 124 248"; return 0; }
- 1
信息
- ID
- 963
- 时间
- 1000ms
- 内存
- 64MiB
- 难度
- 7
- 标签
- 递交数
- 148
- 已通过
- 39
- 上传者