HDU 2620 - Ice Rain (数学)
来源:互联网 发布:在线影视源码 编辑:程序博客网 时间:2024/05/16 05:52
题意
求
思路
所以
可以成段统计。
计算出某个
代码
#include <stack>#include <cstdio>#include <list>#include <cassert>#include <set>#include <iostream>#include <string>#include <vector>#include <queue>#include <functional>#include <cstring>#include <algorithm>#include <cctype>#include <string>#include <map>#include <cmath>using namespace std;#define LL long long#define ULL unsigned long long#define SZ(x) (int)x.size()#define Lowbit(x) ((x) & (-x))#define MP(a, b) make_pair(a, b)#define MS(arr, num) memset(arr, num, sizeof(arr))#define PB push_back#define X first#define Y second#define ROP freopen("input.txt", "r", stdin);#define MID(a, b) (a + ((b - a) >> 1))#define LC rt << 1, l, mid#define RC rt << 1|1, mid + 1, r#define LRT rt << 1#define RRT rt << 1|1const double PI = acos(-1.0);const int INF = 0x3f3f3f3f;const double eps = 1e-8;const int MAXN = 2e3 + 10;const int MOD = 1e9 + 7;const int dir[][2] = { {-1, 0}, {0, -1}, { 1, 0 }, { 0, 1 } };const int hash_size = 4e5 + 10;int cases = 0;typedef pair<int, int> pii;int main(){ LL n, k; while (cin >> n >> k) { LL ans = n*k; if (n > k) n = k; for (int i = 1; i <= n; ) { LL a = k / i; LL ed = k / a; if (ed > n) ed = n; ans -= (i + ed) * (ed - i + 1) / 2 * a; i = ed+1; } cout << ans << endl; } return 0;}
0 0
- HDU 2620 - Ice Rain (数学)
- hdu 2620 Ice Rain(数论)
- HDU 2620 Ice Rain(取模运算规律)
- CodeForces667APouring Rain(数学)
- ZOJ 3923In the Rain(数学)
- 【CodeForces】667A - Pouring Rain(数学)
- 周练L - Pouring Rain 【数学】
- hdu 3340 Rain in ACStar
- HDU-3340-Rain in ACStar
- Rain on your Parade HDU
- Rain on your Parade HDU
- hdu 3363 ice sugar gourd
- hdu 3363 Ice-sugar Gourd
- hdu 3363 Ice-sugar Gourd
- HDU 3363 Ice-sugar Gourd
- HDU 3363 Ice-sugar Gourd
- HDU 3363 Ice-sugar Gourd
- HDU 3363 Ice-sugar Gourd
- 一道简单题——A Simple Task
- 写在新年边上
- 【Android API Guides 简译(一)】App Resourses--Overview
- 关于javascript中for/in循环的标签使用
- getchar()和EOF总结
- HDU 2620 - Ice Rain (数学)
- linux文件系统
- HDFS的基本概念
- uva 10404 Bachet's Game
- HDOJ 1027 Ignatius and the Princess II
- 设计模式_适配器
- 新年快乐,怀恋故乡
- Android Handler,Looper,Message
- 【翻译自mos文章】OUI 的log文件和trace文件的位置