2025/2/28的作业
This commit is contained in:
parent
c39358e3a9
commit
bbd47da19c
22
1.cpp
Normal file
22
1.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
int a = 0,b = 0,c = 0,all = 0;
|
||||
int n;
|
||||
cin >>n;
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
int a1,b1,c1;
|
||||
cin >>a1>>b1>>c1;
|
||||
|
||||
a += a1;
|
||||
b += b1;
|
||||
c += c1;
|
||||
all = a+b+c;
|
||||
}
|
||||
cout <<a<<" "<<b<<" "<<c<<" "<<all<<endl;
|
||||
return 0;
|
||||
}
|
27
2.cpp
Normal file
27
2.cpp
Normal file
@ -0,0 +1,27 @@
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
cout <<"提示:最大四位数"<<endl;
|
||||
int n,num,count = 0;
|
||||
int a,b,c,d;
|
||||
|
||||
cin >>n;
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
cin >>num;
|
||||
|
||||
int a = num / 1000; // 千位
|
||||
int b = (num % 1000) / 100; // 百位
|
||||
int c = (num % 100) / 10; // 十位
|
||||
int d = num % 10; // 个位
|
||||
|
||||
if (a+b+c < d)
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
cout <<count;
|
||||
return 0;
|
||||
}
|
@ -1,8 +0,0 @@
|
||||
#include<bits/stdc++.h>
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main(){
|
||||
|
||||
return 0;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user