背景:主要是学习map相关知识,详见代码
我的代码:#include
#include
#include
#include
#include
using namespace std;
map map1;
mapmap2;
vector vector1,ans;
string string1_lower(string string1){
for(int i=0;i < stri...
分类:
其他好文 时间:
2015-02-06 09:38:26
阅读次数:
106
Problem Description
Eddy是个ACMer,他不仅喜欢做ACM题,而且对于纸牌也有一定的研究,他在无聊时研究发现,如果他有2N张牌,编号为1,2,3..n,n+1,..2n。这也是最初的牌的顺序。通过一次洗牌可以把牌的序列变为n+1,1,n+2,2,n+3,3,n+4,4..2n,n。那么可以证明,对于任意自然数N,都可以在经过M次洗牌后第一次重新得到初始的顺序。编程对于...
分类:
其他好文 时间:
2015-02-06 09:37:50
阅读次数:
117
题意:给定一个电阻值,求得到该电阻值所需单位电阻的最小个数。
思路:逆推,大于电阻值1时减至分数,小于1时取倒数,重复操作。
#include
#include
#include
using namespace std;
long long n,m,num,t;
int i,j,k,rcount,shu,flag,yu;
int main()
{
while(cin>>n)
{...
分类:
其他好文 时间:
2015-02-06 09:37:28
阅读次数:
161
#include
#include
#include
using namespace std;
class Solution {
public:
int compareVersion(string version1, string version2) {
vector v1;
vector v2;
int p=0;
/*方法一:OK*/
/*for(int i=0...
分类:
其他好文 时间:
2015-02-06 09:37:11
阅读次数:
90
Problem Description
There is a large room in the Pyramid called Room-of-No-Return. Its floor is covered by rectangular tiles of equal size. The name of the room was chosen because of the very high ...
分类:
其他好文 时间:
2015-02-06 09:36:59
阅读次数:
185
Problem Description
How far can you make a stack of cards overhang a table? If you have one card, you can create a maximum overhang of half a card length. (We're assuming that the cards must be per...
分类:
其他好文 时间:
2015-02-06 09:36:23
阅读次数:
130
Problem Description
Eddy's company publishes a kind of lottery.This set of lottery which are numbered 1 to n, and a set of one of each is required for a prize .With one number per lottery, how many...
分类:
其他好文 时间:
2015-02-06 09:35:12
阅读次数:
140
Problem Description
As we know, Big Number is always troublesome. But it's really important in our ACM. And today, your task is to write a program to calculate A mod B.
To make the problem easie...
分类:
其他好文 时间:
2015-02-06 09:34:56
阅读次数:
132
题目链接:POJ 2763 Housewife Wind
题意:抽象出来就是 一棵已知节点之间的边权,两个操作,1·修改边权,2·询问两个节点之间的边权和。
AC代码:
#include
#include
#include
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<...
A. Fox And Snake题意:给出行数,输出相应的图形#include #include #include #include using namespace std;int main(){ int n,m,i,j,vis=1; scanf("%d %d",&n,&m); for(i=...
分类:
其他好文 时间:
2015-02-06 09:22:03
阅读次数:
196