A. Kirill And The Game time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Kirill plays a new computer game. He came to the potion store where he can buy any potion. Each potion is characteriz…
CodeForces - 842A 需要将除法改换成乘法进行计算 #include<bits/stdc++.h> using namespace std; int main() { long long l,r,x,y; long long k; while(~scanf("%lld %lld %lld %lld %lld",&l,&r,&x,&y,&k)) { ; for(int i = x; i <= y; i++) { if…
A. Vanya and Cubes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows: the top level of…
A. Vicious Keyboard time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Tonio has a keyboard with only two letters, "V" and "K". One day, he has typed out a string s with only t…
主题链接:点击打开链接 意甲冠军: 特定n*m矩阵 # 是墙 . 和字母是平地 最多有26个字母(不反复出现) 以下k个指令. 每一个指令代表移动的方向和步数. 若以某个字母为起点,依次运行全部的指令,不论什么过程都不会撞到墙或走出地图.则这个字母合法. 按字典序输出全部合法的字母.若没有字母合法则输出' no solution' 预处理一下前缀和然后暴力. #include <cstdio> #include <iostream> #include <algorithm&g…
题意:给定n*n个矩阵,其中只有一个格子是0,让你填上一个数,使得所有的行列的对角线的和都相等. 析:首先n为1,就随便填,然后就是除了0这一行或者这一列,那么一定有其他的行列是完整的,所以,先把其他的算出来,然后再作差就算这个数了, 然后再去验证其他的对不对就好了.除了n为1,其他的都是唯一解应该.或者没有. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #i…
A. Kefa and First Steps time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Kefa decided to make some money doing business on the Internet for exactly n days. He knows that on the i-th day (1 …
http://codeforces.com/problemset/problem/777/D 题意:给出n道字符串,删除最少的字符使得s[i] <= s[i+1]. 思路:感觉比C水好多啊,大概是题目比较难看懂吧.直接从后面往前扫,用后面的答案更新前面的答案.考虑如果后面的字符串比前面的大,那么直接保存当前的字符串,否则暴力扫一遍,前面的字符串大于后面的字符串的那一位直接跳出. #include <bits/stdc++.h> using namespace std; ]; ]; int…
L. Ministry of Truth Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description Andrey works in the Ministry of Truth. His work is changing articles in newspapers and magazines so that they praise the Party an…
B. Archer Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/312/problem/B Description SmallR is an archer. SmallR is taking a match of archer with Zanoes. They try to shoot in the target in turns, and SmallR shoots first. The…