C. Insertion Sort Petya is a beginner programmer. He has already mastered the basics of the C++ language and moved on to learning algorithms. The first algorithm he encountered was insertion sort. Petya has already written the code that implements th…
B. Substrings Sort time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given nn strings. Each string consists of lowercase English letters. Rearrange (reorder) the given strings in such…
D. Bubble Sort Graph time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Iahub recently has learned Bubble Sort, an algorithm that is used to sort a permutation with n elements a1, a2, ..., an …
D. Fools and Foolproof Roads You must have heard all about the Foolland on your Geography lessons. Specifically, you must know that federal structure of this country has been the same for many centuries. The country consists of n cities, some pairs…
A. Two Semiknights Meet 题目大意:有一个8x8的棋盘,上面放有两个骑士,骑士以“田字”的方式走.每个方格都被定义为good或者bad,问骑士能否在good的格子中相遇? 由于骑士最初位于good的格子中,并且骑士可以按原路返回,所以只需判断骑士是否能够相遇就行了(相遇后可以返回任意一个骑士的初始位置).根据骑士的移动特性,两个骑士位置的行和列之差应该为4的倍数. 自己开始的时候,还试图计算相遇位置,然后bfs逐个验证,想麻烦了... #include <cstdio>…
A. Game With Sticks (451A) 水题一道,事实上无论你选取哪一个交叉点,结果都是行数列数都减一,那如今就是谁先减到行.列有一个为0,那么谁就赢了.因为Akshat先选,因此假设行列中最小的一个为奇数,那么Akshat赢,否则Malvika赢. 代码: #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> using namespace…
cf之路,1,Codeforces Round #345 (Div. 2) ps:昨天第一次参加cf比赛,比赛之前为了熟悉下cf比赛题目的难度.所以做了round#345连试试水的深浅..... 其实这个应该是昨天就写完的,不过没时间了,就留到了今天.. 地址:http://codeforces.com/contest/651/problem/A A. Joysticks time limit per test 1 second memory limit per test 256…