- 博客(27)
- 收藏
- 关注
原创 数论中的异或
数论中的异或Time Limit: 1000 MSMemory Limit: 32768 KTotal Submit: 79(41 users)Total Accepted: 38(30 users)Rating: Special Judge: NoDescription给出两集合A和B, 找出最小的非负整数x使得A⊕x=B.假设A={a1,a2,…,an}, A⊕x={a1⊕x,a2⊕x,…,a...
2018-04-30 18:22:23 760
原创 【codeforces 733A】 Grasshopper And the String(模拟)
A. Grasshopper And the Stringtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputOne day, the Grasshopper was jumping on the lawn and found a piece of ...
2018-04-28 19:13:22 234
原创 最大连续子序列和o(n)
#include<iostream>using namespace std;long long a[200005];int n;long long maxsum(long long a[],long long n){ long long ms,mh; ms=mh=a[0]; for(int i=1;i<n;i++) { if(mh<=0) { ...
2018-04-27 18:39:33 361
原创 【codeforces 721A】One-dimensional Japanese Crossword
A. One-dimensional Japanese Crosswordtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently Adaltik discovered japanese crosswords. Japanese cros...
2018-04-27 17:05:03 269695
原创 【codeforces 467B】 Fedor and New Game(位运算模拟)
B. Fedor and New Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter you had helped George and Alex to move in the dorm, they went to help th...
2018-04-26 19:22:20 222
原创 【UVA】Digit Counting(数组水题)
一道思维题,关键在于把多位数转化为个位数,其实一个while就可以了,比较水的题目.AC 代码:#include<iostream>#include<string.h>using namespace std;int c[100001];int re[10];int main(){ int t,n,i; cin>>t; while(t--) {...
2018-04-24 17:39:37 180
原创 快排实现
#include<iostream>#include<cstring>using namespace std;void q_sort(int *a,int left,int right){ if(left>=right) { return ; } swap(a[left],a[(left+right)/2]);...
2018-04-23 16:27:34 177
原创 【FZU2214】Knapsack problem(经典01背包改编)
Problem 2214 Knapsack problemAccept: 837 Submit: 3249Time Limit: 3000 mSec Memory Limit : 32768 KB Problem DescriptionGiven a set of n items, each with a weight w[i] and a value v[i], determine ...
2018-04-22 18:35:41 299
原创 EZDIJKST - Easy Dijkstra Problem(基础有向图最短路)
EZDIJKST - Easy Dijkstra Problemno tags Determine the shortest path between the specified vertices in the graph given in the input data.Hint: You can use Dijkstra's algorithm.Hint 2: if you're a lazy ...
2018-04-18 21:01:29 251
原创 【HDU 1596 】find the safest road(怪我太怂)dijkstra变形
find the safest road Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15957 Accepted Submission(s): 5538 Problem Description...
2018-04-17 17:18:23 135
原创 linux vim基础设置
Linux 编译C++ 与 设置 Vim1. Linux 下编译c++vim test.cpp // 创建文件g++ test.cpp // 编译文件./a.out // 执行文件g++ test.cpp -o new_file.out 编译C++文件,生成new_file.out文件 ( -o 字母 o)2 . 设置 vim vi ~/.vimrcset noba...
2018-04-17 15:45:09 269
原创 【Codeforces 279B】books
B. Bookstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWhen Valera has got some free time, he goes to the library to read so...
2018-04-16 21:21:59 251
原创 树上战争
给一棵树,如果树上的某个节点被某个人占据,则它的所有儿子都被占据,lxh和pfz初始时分别站在两个节点上,谁当前所在的点被另一个人占据,他就输了比赛,问谁能获胜 Input输入包含多组数据 每组第一行包含两个数N,M(N,M<=100000),N表示树的节点数,M表示询问数,N=M=0表示输入结束。节点的编号为1到N。 接下来N-1行,每行2个整数A,B(1<=A,B<=N),表...
2018-04-15 17:59:30 194
原创 【51NOD 1010】只包含因子2 3 5的数
1010 只包含因子2 3 5的数 基准时间限制:1 秒 空间限制:131072 KB 分值: 10 难度:2级算法题 收藏 关注K的因子中只包含2 3 5。满足条件的前10个数是:2,3,4,5,6,8,9,10,12,15。所有这样的K组成了一个序列S,现在给出一个数n,求S中 >= 给定数的最小的数。例如:n = 13,S中 >= 13的最小的数是15,所以输出15。Input第...
2018-04-15 17:14:40 194
原创 N的阶乘的长度(大数)
1058 N的阶乘的长度基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题输入N求N的阶乘的10进制表示的长度。例如6! = 720,长度为3。Input输入N(1 <= N <= 10^6)Output输出N的阶乘的长度Input示例6Output示例3#include<iostream>#include<cstdio>using...
2018-04-15 16:19:26 442
原创 【codeforces 20C】 Dijkstra?(堆优化)最短路
D - Dijkstra? CodeForces - 20C #include<bits/stdc++.h>using namespace std;typedef long long LL; const int MAXN = 1e5 + 10; const LL INF = 1LL<<62; vector<int> e[MAXN];//点 ...
2018-04-13 17:53:10 451 1
原创 【HDU 1875畅通工程再续】(最小生成树)
相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现。现在政府决定大力发展百岛湖,发展首先要解决的问题当然是交通问题,政府决定实现百岛湖的全畅通!经过考察小组RPRush对百岛湖的情况充分了解后,决定在符合条件的小岛间建上桥,所谓符合条件,就是2个小岛之间的距离不能小于10米,也不能大于1000米。当然,为了节省资金,只要求实现任意2个小...
2018-04-12 19:48:47 213
原创 Happy Number
第一次做出来看着那么高大上的题目。。。其实题意很简单,就是让你求快乐数,直接一个while再来个记录数组判断是否有循环就行了。#include<iostream>#include<math.h>#include<string.h>using namespace std;long long sum;int s[1000];int b[999999];...
2018-04-11 21:49:51 175
原创 【codeforces 798A】Mike and palindrome
A. Mike and palindrometime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMike has a string s consisting of only lowercase English letters. He wants t...
2018-04-11 20:58:37 168
原创 【POJ1008】Maya Calendar
Maya CalendarTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 81467 Accepted: 25042DescriptionDuring his last sabbatical, professor M. A. Ya made a surprising discovery about the old Maya cal...
2018-04-08 21:40:20 190
原创 【Codeforces 583A】Asphalting Roads(有意思的题目)
A. Asphalting Roadstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputCity X consists of n vertical and n horizontal infinite roads, forming n × n int...
2018-04-07 20:08:49 184
原创 【51nod 1264】线段相交
1264 线段相交 基准时间限制:1 秒 空间限制:131072 KB 分值: 0 难度:基础题 收藏 关注给出平面上两条线段的两个端点,判断这两条线段是否相交(有一个公共点或有部分重合认为相交)。 如果相交,输出"Yes",否则输出"No"。Input第1行:一个数T,表示输入的测试数量(1 <= T <= 1000)第2 - T + 1行:每行8个数,x1,y1,x2,y2,x3...
2018-04-06 16:00:36 136
原创 【HDU 2036】改革春风吹满地
改革春风吹满地Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 41044 Accepted Submission(s): 21059Problem Description“ 改革春风吹满地,不会AC没关系;实在不行回老家,还有一亩三分...
2018-04-06 11:51:42 726
原创 【HDU 2034】人见人爱A-B
人见人爱A-BTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 95186 Accepted Submission(s): 26576Problem Description参加过上个月月赛的同学一定还记得其中的一个最简单的题目,就是{A...
2018-04-05 17:51:18 186
原创 阶乘0的个数
链接:https://www.nowcoder.com/acm/contest/93/E来源:牛客网题目描述 这个问题很简单,就是问你n的阶乘末尾有几个0? 输入描述:输入第一行一个整数T(1<=T<=100),代表测试组数接下来T行,每行一个数n(1<=n<=10^9)输出描述:对于每组测试数据,输出对应答案#include<iostream>using...
2018-04-05 16:42:57 286
原创 洛谷P1605之走迷宫
题目背景迷宫 【问题描述】给定一个N*M方格的迷宫,迷宫里有T处障碍,障碍处不可通过。给定起点坐标和终点坐标,问: 每个方格最多经过1次,有多少种从起点坐标到终点坐标的方案。在迷宫中移动有上下左右四种方式,每次只能移动一个方格。数据保证起点上没有障碍。输入样例 输出样例【数据规模】1≤N,M≤5题目描述输入输出格式输入格式:【输入】第一行N、M和T,N为行,M为列,T为障碍总数。第二行起点坐标SX...
2018-04-02 12:35:44 241
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人