摘要: DescriptionMisspelling is an art form that students seem to excel at. Write a program that removes the n th character from an input string.InputThe first line of input contains a single integer N , (1≤N≤1000) which is the number of datasets that follow.Each dataset consists of a single line of input 阅读全文
posted @ 2012-11-01 23:19 Joyee 阅读(518) 评论(10) 推荐(0) 编辑
摘要: Description编程求解一个小班同学的测验平均分,得分为0到100之间的整数,由于可能有同学请假等原因,出席同学人数不定,输入以-1作为结束。求解平均数,保留1位小数输出。Input输入分数,直到输入-1结束。Output输出所有分数的平均值,保留1位小数就算对我这种菜鸟也是白痴题了……注意设成浮点型就OK。一次ACView Code 1 #include 2 int main() 3 { 4 float n, total=0.0; 5 int counter=0; 6 while( scanf("%f" , &n) && ( n + 1 &g 阅读全文
posted @ 2012-11-01 23:06 Joyee 阅读(213) 评论(0) 推荐(0) 编辑
摘要: Description 小明有n本新书,要借给3位小朋友,假设每人每次只能借一本。小明想知道一共有多少种不同的借法,聪明的你需要写个程序来帮忙小明,输出一共有多少种借法,并输出这些借法,按照字典序排序。Input输入多个case每个case如下:输入n其中 10 > n >= 3Output对于每个case,第一行,输出借法的个数;接着每一行输出一种借法。一开始没看懂题目什么意思,琢磨半天明白了,就是把ABCD....J这十个字母按字典顺序进行排列。用了实验作业里写的函数,在处理字母的问题上用ASCII码与数字的对应处理,一次ACView Code 1 // Problem#: 6 阅读全文
posted @ 2012-11-01 23:04 Joyee 阅读(329) 评论(0) 推荐(0) 编辑
摘要: Description一只公鸡值五文钱;一只母鸡值三文钱;三只小鸡值一文钱。请问用n文钱买m只鸡的方案有多少种?Input输入有多个case,每个case如下n m其中n,m 2 int main() 3 { 4 int cock, hen, chick, n, m, cost, counter=0, num; 5 6 while( scanf("%d%d", &n, &m ) != EOF ) 7 { 8 for( cock = 0; cock 2 int main() 3 { 4 int cock, hen, chick, n,... 阅读全文
posted @ 2012-11-01 22:55 Joyee 阅读(668) 评论(0) 推荐(0) 编辑
摘要: Description1, 1, 2, 3, 5, 8, 13, 21...... 为菲波拉契数列(Fibonacci Sequence),该数列从第 3 项开始,每项都可表示成前2 项的和,即:F(i)=F(i-1)+F(i-2),i>=3。编程计算第 n 项的值。Input输入有多个case, 每个case是1行,只有一个整数n (1 2 int main() 3 { 4 long long unsigned n, i, a, a2 = 0, a1 = 1; 5 6 while( scanf("%llu", &n) != EOF ) 7 { 8 ... 阅读全文
posted @ 2012-11-01 22:36 Joyee 阅读(328) 评论(0) 推荐(0) 编辑