${\color {green} {\Large{\mathit {晓\ Shad0w0} }} }$

531

icebreaker

hqxx_xxx

zombotany

NBxiang

I_wanna_be_accepted

NO.1-Finn
cht
Hasity

3天前
#include <cstdio>
#include <iostream>

using namespace std;

int main()
{
int n;
cin >> n;

while (n -- )
{
int x;
cin >> x;

int s = 0;
for (int i = 1; i * i <= x; i ++ )
if (x % i == 0)
{
if (i < x) s += i;
if (i != x / i && x / i < x) s += x / i;
}

if (s == x) printf("%d is perfect\n", x);
else printf("%d is not perfect\n", x);
}

return 0;
}


3天前
#include<stdio.h>
int n,t,ans;
int main(){
scanf("%d",&t);
while(t--){
scanf("%d",&n);
if(n==1) ans=0;
else ans=1;
for(int i=2;i<=n/i;i++) if(!(n%i)){
ans+=i;
if(n/i!=i) ans+=n/i;
}
if(ans-n) printf("%d is not perfect",n);
else printf("%d is perfect",n);
puts("");
}
return 0;
}


3天前
#include<iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
cin>>n;
int cx=n/2,cy=n/2;
for(int i=0;i<n;i++)
{
for(int j=0;j<n;j++)
if(abs(i-cx)+abs(j-cy)<=n/2)cout<<'*';//重要结论：曼哈顿距离
else cout<<' ';
cout << endl;
}

return 0;
}


3天前
#include<iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
cin>>n;
while(n--)
{
int x;
cin>>x;
bool flag=1;
for(int i=2;i<x;i++)
{
if(x%i==0)
{
flag=0;
break;
}
}
if(flag==1)
{
cout<<x<<" is prime"<<endl;
}
else
{
cout<<x<<" is not prime"<<endl;
}
}
return 0;
}


3天前
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
int m,n;
for(int i=0;i<10;i++)
{
cin>>m>>n;
if(m<=0||n<=0)
{
break;
}
else
{
if(m>n)
{
swap(m,n);
}
int p=0;
for(int o=m;o<=n;o++)
{
cout<<o<<' ';
p+=o;
}
cout<<"Sum="<<p<<endl;
}
}
return 0;
}

#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int n, m;
while (cin >> n >> m, n > 0 && m > 0)
{
if (n > m) swap(n, m);
int sum = 0;
for (int i = n; i <= m; i ++ )
{
cout << i << ' ';
sum += i;
}
cout << "Sum=" << sum << endl;
}
return 0;
}


3天前
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int a=0,b=1;
for(int i=0;i<n;i++)
{
cout<<a<<' ';
int c=0;
c=a+b;
a=b;
b=c;
}
return  0;
}


3天前
#include<iostream>
#include <algorithm>
using namespace std;
int main()
{
int n;
cin>>n;
while (n--)
{
int a=0;
int x,y;
cin>>x>>y;
if(x>y)
{
swap(x,y);
}
for(int i=x+1;i<y;i++)
{
if(i%2)
{

a+=i;
}

}
cout<<a<<endl;
}
return 0;
}


3天前
#include<iostream>
using namespace std;
int main()
{
int n;
cin>>n;
int x=0,y=0;
for(int i=0;i<n;i++)
{
int a;
cin>>a;
if(a>=10&&a<=20)
{
x+=1;
}
else
{
y+=1;
}
}
printf("%d in\n%d out\n",x,y);
return 0;
}


3天前
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
int n;
int c=0,r=0,f=0;
int s;
cin>>n;
for(int i=0;i<n;i++)
{
int a;
char t;
scanf("%d %c",&a,&t);
if (t=='C')
{
c+=a;
}
else if (t=='R')
{
r+=a;
}
else
{
f+=a;
}
}
s=f+r+c;
printf("Total: %d animals\n", s);
printf("Total coneys: %d\n", c);
printf("Total rats: %d\n", r);
printf("Total frogs: %d\n", f);
printf("Percentage of coneys: %.2lf %%\n", (double)c / s * 100);//除法时，使用“（double）n”指令强制转换字符类型
printf("Percentage of rats: %.2lf %%\n", (double)r / s * 100);
printf("Percentage of frogs: %.2lf %%\n", (double)f / s * 100);

return 0;
}


3天前
#include<iostream>
using namespace std;
int main()
{
int N;
cin>>N;
for(int i=1;i<=10;i++)
{
printf("%d x %d = %d\n",i,N,i*N);
}
return 0;
}