题目传送门 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
题目大意:给定一个序列,多次询问某段区间乘积的φ\varphi值对10007771000777的模我竟然卡过去了233333
将序列分块,记录fi,jf_{i,j}表示第ii块左端点到第jj个点中出现的所有质数pp的p?1p\frac{p-1}p之积
每次询问[x,y][x,y],首先取出[x,y][x,y]区间内所有数的积,然后乘上fst,yf_{st,y}(其中stst是xx后面第一个块端点...
分类:
其他好文 时间:
2015-04-30 18:24:29
阅读次数:
286
Pseudoforest
Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 1932 Accepted Submission(s): 746
Problem Description
In graph theory, ...
分类:
其他好文 时间:
2015-04-30 18:14:06
阅读次数:
103
Standard Reduction Theory主要讲的是当->>能推导出Value时,一定存在一种计算方法,使得|->推出该Value,这里的主要想法是当M->>Value时,对于递归情况会有M->P->>Value,我们在P->>Value上递归,可以得到M->P,P |->Q,Q->> Va...
分类:
其他好文 时间:
2015-04-26 12:12:49
阅读次数:
149
这题居然没有记录,写一下吧:Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesa...
分类:
其他好文 时间:
2015-04-25 18:14:19
阅读次数:
104
Einar LandreiN SYSTEMS THEORY, containment is one of the most useful constructs when dealing with large and complex system structures. In the software industry, the value of containment or encapsulatio...
分类:
其他好文 时间:
2015-04-25 10:50:27
阅读次数:
194
Title:Given a collection of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Each n...
分类:
其他好文 时间:
2015-04-22 11:24:37
阅读次数:
242