emm 单纯的把书上代码过一遍 随便敲的 或许有点出入
B1001 害死人不偿命的(3n+1)猜想
#include<cstdio>
int main()
{
int n,step=0;
scanf("%d",&n);
while(n!=1)
{
if(n%2==0)n=n/2;
else n=(3*n+1)/2;
step++;
}
printf("%d",step);
return 0;
}
B1032 挖掘机技术哪家强
#include<cstdio>
int main()
{
int score[100001]={0};
int N,ID,SUM,ID_MAX,SUM_MAX=0;
scanf("%d",&N);
for(int i=0;i<N;i++)
{
scanf("%d%d",&ID,&SUM);
score[ID]+=SUM;
}
for(int i=1;i<=N;i++)
{
if(score[i]>SUM_MAX)
{
SUM_MAX=score[i];
ID_MAX=i;
}
}
printf("%d %d",ID_MAX,SUM_MAX);
return 0;
}