题意:给定一个串数,表示一种密码锁,再给定一串密码,问你滑动最少的次数,把第一行变成第二行. 析:很简单么,反正只有0-9这个10个数字,那么就是把每一个数从正着滑和倒着滑中找出一个最小的即可,正着滑就是大数减小数,倒着就是小数+10-大数. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e3 + 5; const int INF = 0x3f3f3f3f;…
Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treasures that he's earned fair and square, he has to open the lock. The combination lock is represented by n rotating disks w…
Problem G. Grave 题目连接: http://codeforces.com/gym/100531/attachments Description Gerard develops a Halloween computer game. The game is played on a rectangular graveyard with a rectangular chapel in it. During the game, the player places new rectangul…
题目链接: B. Inventory time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Companies always have a lot of equipment, furniture and other things. All of them should be tracked. To do this, there is…
A. SwapSort time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output In this problem your goal is to sort an array consisting of n integers in at most n swaps. For the given array find the sequence…
题目链接: A. Opponents time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have…
题意:给定两个速度,一个一初速度,一个末速度,然后给定 t 秒时间,还每秒速度最多变化多少,让你求最长距离. 析:其实这个题很水的,看一遍就知道怎么做了,很明显就是先从末速度开始算起,然后倒着推. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e5 + 5; const int INF = 0x3f3f3f3f; vector<int> ans;…
Problem I. iSharpTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=86821#problem/I Description You are developing a new fashionable language that is not quite unlike C, C++, and Java. Since your langua…
题目链接:http://codeforces.com/problemset/problem/705/A 从第三个输出中可看出规律, I hate that I love that I hate it I hate I love 是来回循环的,不到最后一个每一次循环后面都输出 that,如果到最后则输出 it #include<bits/stdc++.h> using namespace std; int main() { ][]= {"I love ","I ha…