Codeforces 1189C Candies!】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/1189/C 思路:前缀和. AC代码: #include<bits/stdc++.h> using namespace std; ; int a[maxn]; int n, m; int ask(int x,int y) { ])/; } int main() { cin >> n; int x , y; ;i <= n;i++) { cin >> a[i]; a[i]…
http://codeforces.com/problemset/problem/1189/C 求一下前缀和,给定区间的数字和除以10就是答案 AC代码: #include<iostream> #include<algorithm> #include<vector> using namespace std; long long seq[100050]; int main(){     long long int num;     cin>>num;     …
题目大意 给定整数 $n, k, l, r$,$1\le n, k \le 10^{11}$,$1\le l, r \le n$ . 令 $ m = r - l + 1$,若 $m \le 0$,$m\gets m + n$ . 未知数 $x\in \mathbb{Z}$ 满足 $ 0 \le x \le n$,且满足 $ k \bmod (n + x) = 0$ 且 $m = n$ :或者 $ k \bmod (n + x) \ne 0$ 且 $0 \le k \bmod (n + x) -…
ACM思维题训练集合 After passing a test, Vasya got himself a box of n candies. He decided to eat an equal amount of candies each morning until there are no more candies. However, Petya also noticed the box and decided to get some candies for himself. This me…
题目大意:给你一个数组每个数不大于9,然后给你m个区间,每个区间的长度都是2的k次方(k=0 1 2.....)  有一种操作是把奇数位和偶数位相加  用和来代替之前的两个数,如果和大于等于10就要膜10并且答案计数+1  .每一个区间询问你需要输出把这个区间的每队奇数位和偶数位不断相加取膜处理.问你最后只剩一个数的时候,取了几次膜. 分析:因为最后都是要加和到只剩一位的,所以直接前缀和然后再除10就是答案了 #include<bits/stdc++.h> using namespace st…
题目地址: 选题为入门的Codeforce div2/div1的C题和D题. 题解: A:CF思维联系–CodeForces -214C (拓扑排序+思维+贪心) B:CF–思维练习-- CodeForces - 215C - Crosses(思维题) C:CF–思维练习–CodeForces - 216C - Hiring Staff (思维+模拟) D:CF思维联系–CodeForces-217C C. Formurosa(这题鸽了) E:CF思维联系–CodeForces - 218C E…
链接: https://codeforces.com/contest/1230/problem/A 题意: Dawid has four bags of candies. The i-th of them contains ai candies. Also, Dawid has two friends. He wants to give each bag to one of his two friends. Is it possible to distribute the bags in suc…
这题给的一个教训:Codeforces没有超时这个概念.本来以为1000*(1000+1)/2*10*10要超时的.结果我想多了. 这题由于k层都可能有关系,所以建一个图,每两个点之间连边,边权为n*m和他们之间的差值*w的最小值,然后求一个最小生成树就可以得出结果.且可以证明不会存在环.由于边比较稠密,用Prim算法求最小生成树. 代码: #include <iostream> #include <cstdio> #include <cstring> #include…
B. Inna and New Matrix of Candies time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Can…
Arkady and his friends love playing checkers on an n×nn×n field. The rows and the columns of the field are enumerated from 11 to nn. The friends have recently won a championship, so Arkady wants to please them with some candies. Remembering an old pa…