《C语言习题课--12级期末考试题专讲.pptVIP

  • 8
  • 0
  • 约6.9千字
  • 约 29页
  • 2016-12-28 发布于北京
  • 举报
C语言12级期末考题讲解 * * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. /JudgeOnline/showcontest?contest_id=1161 * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 1植树问题 Description 某学校植树节开展植树活动,已知树苗有m株,参加植树的同学有n人(且mn),请问每位同学平均可以植树几株?还有几株剩余? Input 输入两个整数m和n,分别表示树苗的数量和学生的人数(mn) Output 输出每位同学平均植树的数量及剩余的树苗数量。 Sample Input 163 32 Sample Output 5 3 * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 1植树问题:code #include stdlib.h main() { int m,n; scanf(%d, m); scanf(%d,n); printf(%d %d, m /b, m %n); } m/b:求商 m%n:求余数 * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 2工资问题 Description 某工厂规定一个工人正常工作时间为每个月160小时。若一个工人本月工作时间不超过160小时,则每小时工资为20元。若本月工作时间超出160小时,超出部分可算作加班时间,加班时间每小时30元。输入该工人当月的工作时间,请计算并输出该工人当月的工资。…………………. Input 输入一个正整数n,表示该工人当月工作n个小时。 Output 输出一个整数,单独占一行,表示该工人当月的工资。 Sample Input 170 Sample Output 3500 * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 2工资问题code #include stdlib.h main() { int n; scanf(%d,n); if(n=160) { printf(%d,20*n); }else{ printf(%d,160*20+(n-160)*30); } } * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 3回文数 Description “回文数”是一个正读和反读都一样的数,编程判断一个5位数n是否是一个回文数。 Input 输入一个整数n,10000=n=99999 Output 判断n是否是一个回文数,如果是,输出yes,否则输出no Sample Input 15751 Sample Output yes * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-2011 Aspose Pty Ltd. 3回文数:code #include stdlib.h main() { int n; scanf(%d,n); if((n/10000==n%10)((n/1000)%10==(n/10)%10)) printf(yes); else printf(no); } * * Evaluation only. Created with Aspose.Slides for .NET 3.5 Client Profile . Copyright 2004-201

文档评论(0)

1亿VIP精品文档

相关文档