镇乃天子
This commit is contained in:
23
20260314/25a.cpp
Normal file
23
20260314/25a.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
int a[100],n;
|
||||
int add(int x,int y){
|
||||
int z=x+y;
|
||||
cout<<n<<endl;
|
||||
return z;
|
||||
}
|
||||
int main(){
|
||||
cin>>n;
|
||||
for(int i=1;i<=n;i++){
|
||||
cin>>a[i];
|
||||
}
|
||||
int z,ans=0;
|
||||
for(int i=1;i<=n;i++){
|
||||
z=add(ans,a[i]);
|
||||
ans=ans+z;
|
||||
}
|
||||
cout<<z<<endl;
|
||||
cout<<ans<<endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
16
20260314/25b.cpp
Normal file
16
20260314/25b.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
void w(int a,int b){
|
||||
if(a>b)
|
||||
cout<<a<<endl;
|
||||
else
|
||||
cout<<b<<endl;
|
||||
|
||||
}
|
||||
int main(){
|
||||
int a,b;
|
||||
cout<<"请输入两个整数:";
|
||||
cin>>a>>b;
|
||||
w(a,b);
|
||||
return 0;
|
||||
}
|
||||
21
20260314/25c.cpp
Normal file
21
20260314/25c.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int x(int n){
|
||||
|
||||
int y=1;
|
||||
for(int i=1;i<=n;i++)
|
||||
y=y*i;
|
||||
return y;
|
||||
|
||||
}
|
||||
|
||||
int main(){
|
||||
int a,b=1;
|
||||
cout<<"请输入一个整数:";
|
||||
cin>>a;
|
||||
|
||||
b=x(a);
|
||||
cout<<b<<endl;
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user