杭电2627
来源:互联网 发布:淘宝刷单平台推荐 编辑:程序博客网 时间:2024/05/29 18:51
水题,水爆了!
#include<stdio.h>
int main()
{
int t,n,i;
char a[100];
int b[100];
scanf("%d",&t);
while(t--)
{
scanf("%d",&n);
getchar();
scanf("%s",a);
int sum=0,p=0;
for(i=0;i<n;i++)
{
scanf("%d",&b[i]);
if(a[i]=='1')
{
p++;
sum+=b[i];
}
}
printf("Samuel was accused with %d case(s),",p);
if(sum==0)printf("and he will stay in the prison for 0 year(s).\n");
else if(sum>0&&sum<20)printf("and he will stay in the prison for 3 year(s).\n");
else if(sum>=20&&sum<30)printf("and he will stay in the prison for 5 year(s).\n");
else if(sum>=30&&sum<40)printf("and he will stay in the prison for 10 year(s).\n");
else if(sum>=40&&sum<50)printf("and he will stay in the prison for 15 year(s).\n");
else if(sum>=50&&sum<60)printf("and he will stay in the prison for 20 year(s).\n");
else if(sum>=60&&sum<70)printf("and he will stay in the prison for 25 year(s).\n");
else if(sum>=70&&sum<80)printf("and he will stay in the prison for 30 year(s).\n");
else if(sum>=80&&sum<90)printf("and he will stay in the prison for 35 year(s).\n");
else
printf("and he will stay in the prison for 40 year(s).\n");
}
return 0;
}
- 杭电2627
- 杭电
- 杭电
- 杭电
- 杭电 1234 和 杭电 2115
- 杭电2056之Rectangles 杭电
- 杭电ACM1061Rightmost Digit
- 杭电2099 7.11
- 杭电ACM 1003
- 杭电 ACM 2016
- 杭电ACM1466
- 杭电ACM1003
- 杭电ACM1225
- 杭电ACM2023
- 杭电ACM2602
- 杭电ACM2955
- 杭电ACM3198
- 杭电ACM2028 求教
- 11级_Java_曹建波 05.06 spring aop术语概述
- 【自定义控件】让你的控件也具有拖拽(drag-and-drop)功能 详细版
- 第一章数据库基础简介
- asp.net 用sqlserver 实现session共享
- 反Secure Boot垄断:兼谈如何在Windows 8电脑上安装
- 杭电2627
- Unix网络编程—基本UDP套接字编程
- 关于将ssh项目移植到weblogic上时出现:ClassNotFoundException:org.hibernate.hql.internal.ast.HqlToken(hibernate4)
- Android之Adapter用法总结
- C语言指针强制类型转
- linux内核栈与用户栈
- HDU-3006The Number of set
- HDU 3308 LCIS(区间合并)转自`Wind
- 防止java反编译的一些常用方法