A. Nastya and Rice 网址:https://codeforces.com/contest/1341/problem/A Nastya just made a huge mistake and dropped a whole package of rice on the floor. ...
分类:
其他好文 时间:
2020-05-04 21:28:22
阅读次数:
77
要求: 输入2个正整数m和n(1<=m<=6, 1<=n<=6),然后输入矩阵a(m行n列)中的元素,分别求出各行元素之和,并输出。试编写相应程序 #include <stdio.h> int main() { int m, n; // m,n作为行、列数 scanf("%d", &m); scan ...
分类:
其他好文 时间:
2020-05-04 17:06:42
阅读次数:
61
最大数#include <stdio.h>#define MAX 10int main() { int n, a[MAX]; printf("Input the number of figure(<10):\n"); scanf("%d",&n); for (int i = 0; i < n; i+ ...
分类:
其他好文 时间:
2020-05-04 15:48:54
阅读次数:
172
累加#include <stdio.h>#define MAX 10int main() { int n; int a[MAX]; int sum = 0; printf("Input the number of figure(<=10):\n"); scanf("%d",&n); for(int ...
分类:
其他好文 时间:
2020-05-04 15:26:15
阅读次数:
73
解法:总和为奇数必为false,如果数字的某种组合能够等于 所有数字的总和/2。 #include <bits/stdc++.h> using namespace std; bitset<50005> flag; ///bitset 在 bitset 头文件中, ///是一种类似数组的结构, /// ...
分类:
移动开发 时间:
2020-05-03 16:15:46
阅读次数:
89
#include<stdio.h> #include<math.h> int main(){ long long n,m,i,x,s; int arr[16] = {2,1,2,3,4,5,6,7,8,9,8,7,6,5,4,3}; scanf("%lld",&n); m = sqrt(2*n);/ ...
分类:
移动开发 时间:
2020-05-03 12:18:57
阅读次数:
112
```//f[i]表示从前i头牛中选,且合法,的所有方案,价值最大//第i头选或不选都可以//不选:变成f[i-1]//选i:需要知道从i开始往前连续选了多少个,最多是k//如果是x个,那么就加上w[i-x+1]+w[i-x+2]...+w[i],也就是s[i]-s[i-j]//那么再往前选的话,下... ...
http://acm.hdu.edu.cn/showproblem.php?pid=1042 代码 无结构体: #include<iostream> #include<string> #include<cstring> #include<algorithm> using namespace std; ...
分类:
其他好文 时间:
2020-05-02 12:16:52
阅读次数:
73
"Enemy is weak" 求序列 $a\{n\}$ 中的三元逆序对数量。 数据范围:$3\le n\le 1e6$。 这题真是一道又好又水的题,可是我看别人的题解做法真是玄学难懂,于是蒟蒻要写一篇简单易懂的。 考虑到 二元逆序对 的做法: 离散化后动态维护一个权值树状数组。 其中对于每个当做逆 ...
分类:
其他好文 时间:
2020-05-01 12:57:30
阅读次数:
71