D. Sea Battle time limit per test: 1 second memory limit per test :256 megabytes input: standard input output: standard output Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships…
A. Robot Sequence time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Calvin the robot lies in an infinite rectangular grid. Calvin's source code contains a list of n commands, each either 'U'…
B. The Queue time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output Finally! Vasya have come of age and that means he can finally get a passport! To do it, he needs to visit the passport office, b…
C. Exponential notation time limit per test: 2 seconds memory limit per test:256 megabytes input: standard input output: standard output You are given a positive decimal number x. Your task is to convert it to the "simple exponential notation".…
A. Robbers' watch time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Robbers, who attacked the Gerda's cab, are very successful in covering from the kingdom police. To make the goal of ca…
Codeforces 438D The Child and Sequence 给出一个序列,进行如下三种操作: 区间求和 区间每个数模x 单点修改 如果没有第二个操作的话,就是一棵简单的线段树.那么如何处理这个第二个操作呢? 对于一个数a,如果模数 x > a ,则这次取模是没有意义的,直接跳过: 如果 x > a/2 ,则取模结果小于 a / 2; 如果 x < a / 2,取模结果小于x,则也小于 a / 2. 所以对于一个数,最多只会做log a次取模操作.这是可以接受的! 对于一…
题目链接:http://codeforces.com/problemset/problem/2/A A. Winner time limit per test 1 second memory limit per test 64 megabytes input standard input output standard output The winner of the card game popular in Berland "Berlogging" is determined acc…
A. Joysticks time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Friends are going to play console. They have two joysticks and only one charger for them. Initially first joystick is charged at…
题目链接 K-Periodic Array 简单题,直接模拟即可. #include <bits/stdc++.h> using namespace std; #define REP(i,n) for(int i(0); i < (n); ++i) #define rep(i,a,b) for(int i(a); i <= (b); ++i) + ; int a[N]; int n, k; int ans; int b[N], c[N]; int x; int main(){ sc…
题目链接: C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a gift Loki gave him a smartphone. There are n applications on this phone. Thor is fasci…
题意: 模拟模拟~~ 代码: #include<iostream> using namespace std; const int maxn = 1005; int a[maxn], b[maxn], fa[maxn], fb[maxn]; int main (void) { int n;cin>>n; for(int i = 1; i <= n; i++){ cin>>a[i]; if(i==1) fa[i] = a[i]; else fa[i] = fa[i-1…
A. Power Consumption Calculation time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Tom is interested in power consumption of his favourite laptop. His laptop has three modes. In normal mode l…
A. Face Detection time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output The developers of Looksery have to write an efficient algorithm that detects faces on a picture. Unfortunately, they are cu…
题意:给定a,b,每个单位时间可以将a,b中一台加1,一台减2,求最久可以支持多久. #include <cstdio> #include <algorithm> using namespace std; const int N=256; int n1,n2; int cnt; int main(void) { scanf("%d%d",&n1,&n2); while (n1>0&&n2>0) { if (n1<…
E. Read Time time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mad scientist Mike does not use slow hard disks. His modification of a hard drive has not one, but n different heads that can re…
A. Extract Numbers time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output You are given string s. Let's call word any largest sequence of consecutive symbols without symbols ',' (comma) and '…
A. Unimodal Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Array of integers is unimodal, if: it is strictly increasing in the beginning; after that it is constant; after that it is…