Codeforces 540A - Combination Lock】的更多相关文章

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…
题意:给定一个串数,表示一种密码锁,再给定一串密码,问你滑动最少的次数,把第一行变成第二行. 析:很简单么,反正只有0-9这个10个数字,那么就是把每一个数从正着滑和倒着滑中找出一个最小的即可,正着滑就是大数减小数,倒着就是小数+10-大数. 代码如下: #include <bits/stdc++.h> using namespace std; typedef long long LL; const int maxn = 1e3 + 5; const int INF = 0x3f3f3f3f;…
题目传送门 /* 贪心水题:累加到目标数字的距离,两头找取最小值 */ #include <cstdio> #include <iostream> #include <algorithm> #include <cstring> using namespace std; ; const int INF = 0x3f3f3f3f; char s[MAXN], t[MAXN]; int main(void) //Codeforces Round #301 (Div…
A. Combination Lock Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/540/problem/A Description Scrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to put there the treas…
https://codeforces.com/contest/1097/problem/A Petr and a Combination Lock time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Petr has just bought a new car. He's just arrived at the most known…
时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Microsoft interviewer is in the room though the door is locked. There is a combination lock on the door. There are N rotators on the lock, each consists o…
传送门 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Microsoft interviewer is in the room though the door is locked. There is a combination lock on the door. There are N rotators on the lock, each consis…
Combination Lock 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Microsoft interviewer is in the room though the door is locked. There is a combination lock on the door. There are N rotators on the lock…
A :Combination Lock 题意就是有一个密码箱,密码是n位数,现在有一个当前箱子上显示密码A和正确密码B,求有A到B一共至少需要滚动几次: 简单循环:…
题目1 : Combination Lock 时间限制:10000ms 单点时限:1000ms 内存限制:256MB 描述 Finally, you come to the interview room. You know that a Microsoft interviewer is in the room though the door is locked. There is a combination lock on the door. There are N rotators on th…