ural 2065 - Different Sums
来源:互联网 发布:python web 开发 编辑:程序博客网 时间:2024/04/30 14:08
题意:给出n、m,要求用m个不同的数字组成n个数字的序列,使得不同区间不同的区间和的不同数值数量最少。
前m个数字0,1,-1,2,-2……剩下的部分全补0.
#include <iostream>#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main() { int n, k, i, j, m; while(~scanf("%d%d", &n, &k)) { m = 0; for(i = 0; i < n; i++) { if(i) printf(" "); if(k) { k--; printf("%d", m); if(m <= 0) m = 1 - m; else m = -m; } else printf("0"); } printf("\n"); } return 0;}
0 0
- ural 2065 - Different Sums
- ural- 2065 Different Sums
- ural 1048 Superlong Sums
- ural 1048. Superlong Sums 模拟
- URAL2065:Different Sums(找规律)
- [构造 数学推导] HDU 5847 Different Sums
- HDU 5847 Different Sums (构造+数学+打表)
- POJ 2602|URAL 1048|Superlong Sums|高精度加法
- Sums
- sums
- different
- URAL
- 【ural】
- URAL
- URAL
- URAL
- URAL
- URAL
- jquery easyui window 不居中有关问题解决方案 (注意红色字体部分)
- 手机自适应设计代码以及案例
- 圆
- java实现二维码生成,使用Google zxing
- The servlets named [LogRecord] and [com.action.service.imp.LogServiceImp] are both mapped to the url
- ural 2065 - Different Sums
- 快排
- comparator接口与Comparable接口的区别
- 网格
- Java概述
- 凸包
- #155 Minimum Depth of Binary Tree
- 使用光线投射实现相机跟随
- web前端面试题