A. Combination Lock拨密码。。最少次数。。密码最多有1000位。用字符串存起来,然后每位大的减小的和小的+10减大的,再取较小值加起来就可以了。。。#include#include#include#include#include#include#include#include#in...
分类:
其他好文 时间:
2015-05-07 21:47:48
阅读次数:
130
今天唯一的成果就是把上次几个人一起开房打的那场cf补一下。A. Combination Lock此等水题看一眼样例加上那个配图我就明白题意了,可是手抽没有注释掉freopen,WA了一发。 1 #include 2 using namespace std; 3 4 const int maxn .....
分类:
其他好文 时间:
2015-05-06 01:11:47
阅读次数:
224
Combination Sum II
Given a collection of candidate numbers (C) and a target number (T), find all unique combinations in C where
the candidate numbers sums to T.
Each number in C may only b...
分类:
其他好文 时间:
2015-05-04 15:33:51
阅读次数:
91
A - Combination Lock
题意:
给两个密码,为最小多少次能吻合。
思路:
对于每一位设a
#include
using namespace std;
int main()
{
int n;
char x[1234],y[1234];
while(cin>>n)
{
scanf("%s%s",x,y);
int ans...
分类:
其他好文 时间:
2015-05-04 10:07:11
阅读次数:
129
Combination Sum
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where
the candidate numbers sums to T.
The same repeated number may be chosen ...
分类:
其他好文 时间:
2015-05-03 23:45:39
阅读次数:
142
感觉这次的题目顺序很不合理啊...A. Combination LockScrooge McDuck keeps his most treasured savings in a home safe with a combination lock. Each time he wants to pu.....
分类:
其他好文 时间:
2015-05-02 20:41:04
阅读次数:
197
题目传送门 1 /* 2 贪心水题:累加到目标数字的距离,两头找取最小值 3 */ 4 #include 5 #include 6 #include 7 #include 8 using namespace std; 9 10 const int MAXN = 1e3 + 10;11...
分类:
其他好文 时间:
2015-05-01 19:54:03
阅读次数:
127
题目传送:Codeforces Round #301 (Div. 2)
A. Combination Lock
水题,求最小移动次数,简单贪心一下即可
AC代码:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#inclu...
分类:
其他好文 时间:
2015-05-01 12:09:59
阅读次数:
217
A - Combination Lock
题目大意:给有n个(0-9)环圈密码锁,数串 s1->s2最少移动次数;
题目分析:
简单模拟;
代码:
const int N=100007;
char s1[N],s2[N];
int main()
{
int n;
while(scanf("%d",&n)==1)
{
int ans=0;
...
分类:
其他好文 时间:
2015-05-01 12:07:42
阅读次数:
185
1.题目描述:点击打开链接
2.解题思路:本题要求当前的密码经过最少的转动后和最终的密码一样。可以利用贪心法解决。考虑第i位,假设当前位a,目标为b,那么有两种转动方式,所需的步数分别为abs(a-b)和10-abs(a,b),取较小者即可。累加后即为最小的步数。
3.代码:#define _CRT_SECURE_NO_WARNINGS
#include
#include<...
分类:
其他好文 时间:
2015-05-01 12:03:16
阅读次数:
118