lightoj(基础数学)
2015-09-28 20:33
218 查看
点击题目链接
/***************************************** Author :Crazy_AC(JamesQi) Time :2015 File Name : *****************************************/ // #pragma comment(linker, "/STACK:1024000000,1024000000") #include <iostream> #include <algorithm> #include <iomanip> #include <sstream> #include <string> #include <stack> #include <queue> #include <deque> #include <vector> #include <map> #include <set> #include <stdio.h> #include <string.h> #include <math.h> #include <stdlib.h> #include <limits.h> using namespace std; #define MEM(a,b) memset(a,b,sizeof a) typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int> ii; const int inf = 1 << 30; const int INF = 0x3f3f3f3f; const int MOD = 1e9 + 7; int main() { // freopen("in.txt","r",stdin); // freopen("out.txt","w",stdout); int num,n; LL kase = 0; cin >> num; while(num--){ LL res = 0; kase++; cin >> n; LL t1,t2; for (LL i = 1;i <= n;i = t2 + 1){ t1 = n / i; t2 = n / t1; res += (LL)t1 * (t2 - i + 1); } printf("Case %lld: %lld\n",kase,res); } return 0; }
相关文章推荐
- 编译原理:第七节 及词法分析器的C++和Python实现
- Evaluate Reverse Polish Notation(堆栈)
- cocos代码研究(2)Layer学习笔记
- net-snmp配置文件详解
- Linux学习笔记——系统启动流程
- [APUE]再读之高级IO
- iOS大典之动态相册
- opengl的三维与二维转换
- CYC- 复杂对象归档 反归档
- glib学习--hash table02
- 线段树的总结1
- PHP安全编程:记住登录状态的安全做法
- 学写jquery插件
- glib学习--hash table01
- 十进制转换为二进制序列,并输出1的个数,和序列的奇偶序列
- 数据持久化的方式
- UI 第1讲 UIView
- windows android studio环境下.so文件的配置
- C/C++中结构体的区别
- Random Forests