An Easy Problem
来源:互联网 发布:手机兼职软件 编辑:程序博客网 时间:2024/06/05 04:23
题目信息:你有两个整数L和R,你的任务是计算L与R之间数字的平方总和(包括L和R)
#include<stdio.h>int main() {int t;scanf("%d", &t);while (t--) {long long sum = 0, a, b;scanf("%lld%lld", &a, &b);if (a > b) {int t = a;a = b;b = t;}for(long long i = a; i <= b; i++)sum += i * i;printf("%lld\n", sum);}return 0;}分析:做这个题的时候应该注意两个问题(1)输入a与b的前后次序,因为a与b的大小是任意的。(2)定义数据时的类型。
0 0
- An Easy Problem
- 2055 An easy problem
- An Easy Problem!
- An Easy Problem!
- poj2826 An Easy Problem?!
- HDOJ2055 An easy problem
- An Easy Problem
- hdu-An Easy Problem
- hdu2601 An easy problem
- An Easy Problem
- hdu-An Easy Problem
- HDU_2055 An easy problem
- HDU_2123 An easy problem
- B - An easy problem
- B - An easy problem
- An easy problem
- An easy problem 2132
- An easy problem 2123
- Splay终极模板
- Android 5.x OTA Update官方文档(五、Recovery系统下分区映射)
- 原码 补码 反码及进制转换
- vs2013安装xna4.0模板
- Sicily 11599. Tight words
- An Easy Problem
- Mac os x 10.10上使用quicktime录制iphone屏幕
- java连接各种数据库的代码大全
- 备忘:Integer.valueOf抛出NumberFormatException
- 优秀管理者的判断标准
- Ubuntu下Sublime Text 3解决无法输入中文的方法
- 黑马程序员-iOS视频学习之五
- 第15题
- git reset的用法