Given two pair of integers (a1,b1) and (a2,b2),can you calculate the expanded form of (a1x+b1)(a2x+b2)?
(note that we use "x^2" to express x2 and omit "")
这次你需要考虑系数为0的情况,即: 2x^2+0x+1, 这样应该写成: 2x^2+1
input
1 0
1 0
output
x^2
1003 Sum the digits in a big integer
Time Limit: 1sec Memory Limit:256MB
Description:
Write a program that reads an integer with 3 digits and adds all the digits in the integer.For example,if an integer is 932,the sum of all its digits is 9+3+2=14.
现在要假设处理的数字非常大( 2^64 < length <= 10^200 )
问题反馈
本周题目仍然较为简单,大概60多个同学课上把一周的题目都做完了。
\ 学有余力的同学最好做一下扩展练习题 **
存在如下一些问题: 1、
scanf("%d", &a)
的第一个参数是格式化字符串,在要求键盘输入多个变量时候,格式化字符串中间不应该用逗号隔开,格式化字符串中也不应该出现换行符号。同时,输入的时候应该要使用取地址符号&,不使用则会出错。以下几种情况均为错误的:正确写法:
2、printf中前面是格式化字符串,很多同学不理解printf的机制。
也就是说前面的格式化字符串定义了输出的格式,其中%d是等待某个整型变量来填充进去的意思。
printf中的变量带有取地址符号是不能输出我们期望输出的变量的。 printf格式化字符串中的参数和后面不对应也是错误的。 以下写法是错误的:
3、记得输出需要换行
4、空格和回车在输入整数时候的作用是相同的: 1 2 3 4 与 1 2 3 4 若都是输入4个整数,这两者是一样的。
扩展练习
1000 Triangle II
Time Limit: 1sec Memory Limit:256MB
Description:
输入一个数,输出对应的这样的图像: link
1001 A/B
Time Limit: 1sec Memory Limit:256MB
Description:
输入两个整数A和B,输出这两个整数的商A除以B,保留两位小数。 注意:当除数为0时候应当输出“Error!”
input
3 5
output
0.60
input
1 0
output
Error!
HINT:
注意使用浮点数运算
1002 Polynomial II
Time Limit: 1sec Memory Limit:256MB
Description:
Given two pair of integers (a1,b1) and (a2,b2),can you calculate the expanded form of (a1x+b1)(a2x+b2)? (note that we use "x^2" to express x2 and omit "") 这次你需要考虑系数为0的情况,即: 2x^2+0x+1, 这样应该写成: 2x^2+1
input
1 0 1 0
output
x^2
1003 Sum the digits in a big integer
Time Limit: 1sec Memory Limit:256MB
Description:
Write a program that reads an integer with 3 digits and adds all the digits in the integer.For example,if an integer is 932,the sum of all its digits is 9+3+2=14. 现在要假设处理的数字非常大( 2^64 < length <= 10^200 )
(length 指的是数字的大小!不是长度!╮(╯▽╰)╭)
input
123456789011121314151617181920
output
101
扩展练习题测试数据
第二周测试数据
评测地址
YOJ 在线评测(校园内网)