编程介的小学生 2019-06-21 17:20 采纳率: 20.5%
浏览 308

分段函数的讨论的计算,怎么采用C语言的程序设计的代码编程的方式来实现的呢

Problem Description
Samuel,Former Zua leader,was arrested and had to stay in prison during the Spring Festival. He was in custody for money laundering and other cases.
According to the report,Samuelwas alleged to have embezzled 104 million New Zua dollars (3.15million)inpublicfunds,acceptedbribesofabout9 million in a land purchase deal, and taken a kickback of $2.7 million from a construction project.
Although Samuel is a smart lawyer,he was still arrested due to his illegal actions.
Now Samuel has a question for you:If you are given the legislations of Zua,can you tell how many years he stay in the prison?
The legislations of Zua are supposed as the following few lines:

Input
Input will contains 3 parts. There is an integer t in the first line meaning t test cases. Then the next line has 2 parts:n(represents the cases Samuel was accused with),s(a string with the length of n,only contains “0”,”1”.Here ‘0’means he was not accused with this case,and ‘1’means he was accused with this case ) .The next n lines have the numbers of New Zua dollars(the unit is million) he was accused with.

Output
According to the law,please output how many years Samuel will stay in the prison. Use the format”Samuel was accused with m case(s),and he will stay in the prison for c year(s).”Here m means the case number,c means the years he have to stay.

Sample Input
2
3
011
10 5 15
5
01101
1 10 10 100 31

Sample Output
Samuel was accused with 2 case(s),and he will stay in the prison for 5 year(s).
Samuel was accused with 3 case(s),and he will stay in the prison for 20 year(s).

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 回答4f系统的像差计算
    • ¥15 java如何提取出pdf里的文字?
    • ¥100 求三轴之间相互配合画圆以及直线的算法
    • ¥100 c语言,请帮蒟蒻写一个题的范例作参考
    • ¥15 名为“Product”的列已属于此 DataTable
    • ¥15 安卓adb backup备份应用数据失败
    • ¥15 eclipse运行项目时遇到的问题
    • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
    • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
    • ¥15 自己瞎改改,结果现在又运行不了了