20-22 AC 23 WA
This commit is contained in:
26
2020.cpp
Normal file
26
2020.cpp
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <iostream>
|
||||
#define abs(x) ((x)>0?(x):(-x))
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n;
|
||||
while (cin >> n && n!=0){
|
||||
int *i = new int[n]{0};
|
||||
for(int j = 0;j<n;j++){
|
||||
cin >> i[j];
|
||||
for(int ii = 0; ii < j ;ii++){
|
||||
if(abs(i[ii])<abs(i[j])){
|
||||
int tmp = i[j];
|
||||
for(int jj = 0;jj<j-ii;jj++)
|
||||
i[j-jj] = i[j-jj-1];
|
||||
i[ii] = tmp;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
for(int j = 0;j<n-1;j++)
|
||||
cout << i[j] << ' ';
|
||||
cout << i[n-1] << endl;
|
||||
delete[](i);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
19
2021.cpp
Normal file
19
2021.cpp
Normal file
@@ -0,0 +1,19 @@
|
||||
#include <iostream>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n;
|
||||
while (cin >> n && n!=0){
|
||||
int r100=0,r50=0,r10=0,r5=0,r2=0,r1=0,tmp;
|
||||
for(;n>0;n--){
|
||||
cin >> tmp;
|
||||
for(;tmp>=100;tmp-=100) r100++;
|
||||
for(;tmp>=50;tmp-=50) r50++;
|
||||
for(;tmp>=10;tmp-=10) r10++;
|
||||
for(;tmp>=5;tmp-=5) r5++;
|
||||
for(;tmp>=2;tmp-=2) r2++;
|
||||
for(;tmp>=1;tmp-=1) r1++;
|
||||
}
|
||||
cout << r100+r50+r10+r5+r2+r1 << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
16
2022.cpp
Normal file
16
2022.cpp
Normal file
@@ -0,0 +1,16 @@
|
||||
#include <iostream>
|
||||
#define abs(x) ((x)>0?(x):-x)
|
||||
using namespace std;
|
||||
int main(){
|
||||
int m,n;
|
||||
while (cin >> m >> n){
|
||||
int max=0,maxi=0,tmp;
|
||||
for(int i = 0;i<m*n;i++){
|
||||
cin >> tmp;
|
||||
if(abs(tmp)>abs(max))
|
||||
maxi = i,max = tmp;
|
||||
}
|
||||
cout << maxi/n+1 << ' ' << maxi%n +1 << ' '<< max << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
31
2023WA.cpp
Normal file
31
2023WA.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
#include <iostream>
|
||||
#include <iomanip>
|
||||
using namespace std;
|
||||
int main(){
|
||||
int n,m;
|
||||
while (cin >> n >> m){
|
||||
double *c = new double[m]{0},*i = new double[n*m]{0};
|
||||
int count=0,tmp=0;
|
||||
for(int ii = 0;ii<n*m;ii++){
|
||||
cin >> i[ii];
|
||||
c[ii%m] += i[ii];
|
||||
if((ii%m == 0 && ii !=0))
|
||||
(cout << setiosflags(ios::fixed) << setprecision(2) << (float)tmp/m << ' '),tmp=0;
|
||||
if(ii == n*m-1){
|
||||
cout << setiosflags(ios::fixed) << setprecision(2) << (float)(tmp+i[ii])/m << endl;
|
||||
for(int j = 0;j<m-1;j++)
|
||||
cout << (c[j] /= n) << ' ';
|
||||
cout << (c[m-1] /= n) << endl;
|
||||
}
|
||||
tmp += i[ii];
|
||||
}
|
||||
for(int ii = 0;ii<n;ii++){
|
||||
for(int j = 0;j<m;j++)
|
||||
if(i[ii*m+j]<c[j])goto out;
|
||||
count++;
|
||||
out:;
|
||||
}
|
||||
cout << count << endl;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user