- 你的数组从0开始用还是从1开始用?你觉得这浪费吗?
- 你在编写一些简单函数(例如
cmp,max,gcd)会使用三目运算符还是if?会压行吗?
- 你用的是cin,scanf还是getint(自写读入函数)?
- 下面是一份代码,请用你的码风写一遍。
#include <iostream>
#include <algorithm>
#include <cstdio>
#include <cstdlib>
using namespace std;
int gcd(int a,int b){return b==0?a:gcd(b,a%b);}
struct c{
int d;
char e;
c(int d=9,char e=0):d(d),e(e){};
int f(int g){
int h=d;
return max(g,h);
}
}cS[10];
int main(){
int i;
cin>>i;
for(int j=1;j<=10;j++){
cout<<j<<endl;
}
if(i%3==0) cout<<1;
else if(i%3==1) cout<<2;
else if(i%3==2){
switch(i%1029){
case 0:
cout<<"114514"<<endl;
break;
default:
cout<<"1145141919810"<<endl;
}
}
srand(1920);
int h[2024]={};
for(int k=1;k<=2020;k++) h[k]=rand();
sort(h+1,h+2020+1,[](int a,int b)->bool{return a<b;});
for(int l=1;l<=2020;l++) cout<<h[l]<<endl;
return 0;
}