国产精品天干天干,亚洲毛片在线,日韩gay小鲜肉啪啪18禁,女同Gay自慰喷水

歡迎光臨散文網(wǎng) 會(huì)員登陸 & 注冊(cè)

哈哈

2023-06-25 18:09 作者:Riko_Ishiguro  | 我要投稿

素?cái)?shù)判斷

#include <iostream>

using namespace std;

int main()

int n;

cin>>n;

if(n<=1)

{

cout<<n<<"不是素?cái)?shù)"<<endl;

return 0;

}

for(int i=2;i<n;i++)

{

if(n%i==0)

{

cout<<n<<"不是素?cái)?shù)"<<endl;

return 0;

}

}

cout<<n<<"是素?cái)?shù)"<<endl;

return 0;

閏年

#include <iostream>

using namespace std;

?

?

int main()

{

???int N;

???cin>>N;

???if(N%400==0||N%100!=0&&N%4==0)

???cout<<N<<"是閏年";

???else

???cout<<N<<"不是閏年";

???return 0;

?}

反序數(shù)是素?cái)?shù)

#include <iostream>;

#include <cmath>;

?

?

using?namespace?std;

?

bool?isprime(int?N)

{

????for(int?i = 2; i < sqrt(N*1.0); i++)

????{

????????if(N % i == 0)

????????{return?false;}

????}

????return?true;

}

int?rev(int?N)

{

????int?res = 0;

????while(N > 0)

????{

????????res = res*10 + N %10;

????????N = N/10;

????}

????return?res;

}?

int?main()

{

????int?N = 107;

????cin >> N;

????//cout << 1;

????for(int?i = 100; i <= N; i++)

????{

????????//cout << i << '\t' << isprime(i) << '\t' << rev(i) << '\t' << isprime(rev(i)) << '\n';

?????????

?

????????if((isprime(i) == isprime(rev(i))) &&

?(isprime(i) == true))

????????{??????cout << i << ' ';?}

????}?????

????return?0;

}

讀書問題

#include <iostream>

#include <string>

int?main()

{

????int?N = 0;

????std::cin >> N;

?????

????int?res = 3;

?????

????for?(int?i = N; i > 1;i--)

????{

????????res = (res + 2) * 2;

????}

????std::cout << res;

}

辛普森積分1

#include<bits/stdc++.h>

using?namespace?std;

double?f(double?x)

{?return?sin(x)-cos(x)+x/3.0*x*x;}

int?main()

{

????double?l,r;

????cin>>l>>r;

????cout<<f(r)-f(l);??????

????return?0;

}

7.幾何周長按面積排序

#include<bits/stdc++.h>

using?namespace?std;

int?n;

double?f(double?x)

{

????return?pow(x,2);

}

struct?node

{

????int?tp;

????double?x1,x2,x3,y1,y2,y3;

????double?zxx,zxy,ysx,ysy;

????double?xx,xy,r;

????double?c;

}a[100005];

bool?cmp(node x,node y)

{

????return?x.c<y.c;

}

void?print(double?x)

{

????long?long?a=(long?long)x*10000,b=(long?long)x*100000;

????a=a%10;b=b%10;

????if(a>0) cout<<fixed<<setprecision(4)<<x;

????else?if(a==0&&b==0) cout<<x;

????else?if(b>=5) cout<<fixed<<setprecision(4)<<x;

????else?cout<<x;

}

int?main()

{

????cin>>n;

????string s;

????for(int?i=1;i<=n;i++)

????{

????????node t;

????????cin>>s;

????????if(s=="CTriangle")

????????{

????????????t.tp=1;

????????????cin>>t.x1>>t.y1>>t.x2>>t.y2>>t.x3>>t.y3;

????????????double?dx1=t.x1-t.x2,dx2=t.x1-t.x3,dy1=t.y1-t.y2,dy2=t.y1-t.y3;

????????????t.c=0.5*abs(dx1*dy2-dx2*dy1);

????????}

????????else?if(s=="CCircle")

????????{

????????????t.tp=2;

????????????cin>>t.xx>>t.xy>>t.r;

????????????t.c=3.1416*t.r*t.r;

????????}

????????else

????????{

????????????t.tp=3;

????????????cin>>t.zxx>>t.zxy>>t.ysx>>t.ysy;

????????????t.c=abs(t.zxx-t.ysx)*abs(t.zxy-t.ysy);

????????}

????????a[i]=t;

????}

????sort(a+1,a+n+1,cmp);

????for(int?i=1;i<=n;i++)

????{

????????if(a[i].tp==1)

????????{

????????????cout<<"CTriangle{("<<a[i].x1<<", "<<a[i].y1<<"), ("<<a[i].x2<<", "<<a[i].y2<<"), ("<<a[i].x3<<", "<<a[i].y3<<")},area=";

????????}

????????else?if(a[i].tp==2)

????????{

????????????cout<<"CCircle{("<<a[i].xx<<", "<<a[i].xy<<"),"<<a[i].r<<"},area=";

????????}

????????else

????????{

????????????cout<<"CRectangle{("<<a[i].zxx<<", "<<a[i].zxy<<"), ("<<a[i].ysx<<", "<<a[i].ysy<<")},area=";

????????}

????????print(a[i].c);

????????cout<<endl;

????}

????return?0;

}

?

數(shù)組求中位數(shù)和均值

#include<bits/stdc++.h>

using?namespace?std;

bool?cmp(int?a,int?b)

{

????return?abs(a)>abs(b);

}

int?main()

{

????int?a[105],n,ans,sum=0;

????cin>>n;

????for(int?i=1;i<=n;i++) cin>>a[i],sum+=a[i];

????sort(a+1,a+n+1);

????if(n%2==0) cout<<(double)(a[n/2]+a[n/2+1])/2<<endl;

????else?cout<<a[n/2+1]<<endl;

????cout<<(double)sum/n;

????return?0;

}


哈哈的評(píng)論 (共 條)

分享到微博請(qǐng)遵守國家法律
牟定县| 平谷区| 大余县| 泸定县| 大安市| 丹巴县| 乌恰县| 右玉县| 揭阳市| 舞阳县| 济源市| 广丰县| 怀化市| 梁山县| 乌拉特后旗| 洛浦县| 屏边| 德令哈市| 彰武县| 绵竹市| 体育| 慈溪市| 磴口县| 贺州市| 井陉县| 颍上县| 屏边| 澄江县| 清徐县| 伊通| 左云县| 阳原县| 翁牛特旗| 潞西市| 宜都市| 色达县| 德保县| 桓台县| 巴林左旗| 卢湾区| 奈曼旗|