自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(65)
  • 收藏
  • 关注

原创 1075. PAT Judge

1075. PAT Judge (25)时间限制200 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueThe ranklist of PAT is generated from the status list, which shows the scores of the submittions. This time you are suppos...

2018-02-22 17:22:55 300

原创 1110. Complete Binary Tree

1110. Complete Binary Tree (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a tree, you are supposed to tell if it is a complete binary tree.Input Specification:Each input file cont...

2018-02-21 17:49:35 265

原创 1130. Infix Expression

1130. Infix Expression (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a syntax tree (binary), you are supposed to output the corresponding infix expression, with parentheses refle...

2018-02-14 23:25:38 293

原创 1129. Recommendation System

1129. Recommendation System (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueRecommendation system predicts the preference that a user would give to an item. Now you are asked to program ...

2018-02-14 23:16:21 318

原创 1034. Head of a Gang

1034. Head of a Gang (30)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueOne way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A...

2018-02-12 16:23:27 285

原创 1139. First Contact

1139. First Contact (30)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueUnlike in nowadays, the way that boys and girls expressing their feelings of love was quite subtle in the early years....

2018-02-10 22:23:04 458

原创 1053. Path of Equal Weight

1053. Path of Equal Weight (30)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueGiven a non-empty tree with root R, a

2018-02-06 19:39:05 257

原创 1033. To Fill or Not to Fill

1033. To Fill or Not to Fill (25)时间限制100 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者ZHANG, GuochuanWith highways available, driv

2018-01-28 21:38:23 268

原创 1012. The Best Rank

1012. The Best Rank (25)时间限制400 ms内存限制65536 kB代码长度限制16000 B判题程序Standard作者CHEN, YueTo evaluate the performance of our first yea

2018-01-25 15:47:53 191

原创 Codeforces 778B. Weird Rounding

题意:给你一个数,可以随意删除这个数的每一位,最少删几位是使剩下的数能被10的k次方整除。思路:就是判断数中有几个0,如果数量大于等于k,就随便删除使数的后k位都为0;如果数量小于k,那就删len-1个数,只留一个0.#includeusing namespace std;char str[15];int main(){ int k,sum,sum1; while(

2017-02-28 21:31:30 435

原创 Codeforces 778A. Pupils Redistribution

题意:给你两个序列,每个序列的数的范围是从1到5,问最少要交换多少次,使序列1与序列2相同。这个题当时没写出来,不知道是怎么模拟的,之后看了人家的博客后才明白。。。#include#define manx 100005using namespace std;int main(){ int n,x,a[6]={0},b[6]={0}; scanf("%d",&n);

2017-02-28 21:25:10 347

原创 748 C. Santa Claus and Robot codeforces

#includeusing namespace std;int main(){ int n; string str; cin>>n>>str; int n1=0,n2=0,sum=0; for(int i=0;i<str.size();i++) { if(str[i]=='L') { if

2016-12-27 22:17:44 431

原创 748 B. Santa Claus and Keyboard Check

#includeusing namespace std;mapmap1;mapmap2;int main(){ string str1,str2; cin>>str1>>str2; int flag=0,sum=0; for(int i=0;i<str1.size();i++) { if(map1[str1[i]]==NULL&&m

2016-12-27 22:16:46 413

原创 748 A. Santa Claus and a Place in a Class codeforces

#includeusing namespace std;int main(){ int n,m,k,now=1,flag=0,i,j; cin>>n>>m>>k; for(i=1;i<=n;i++) { for(j=1;j<=m;j++) { if(i==1&&j==1)

2016-12-27 22:16:06 379

原创 742 B - Arpa’s obvious problem and Mehrdad’s terrible solution codeforces

#include using namespace std; int num[1000005]; int main() { int n,x,temp; long long ans=0; cin>>n>>x; while(n--) { cin>>temp; ans+=num[temp^x];

2016-12-27 22:14:37 595

原创 742 A - Arpa’s hard exam and Mehrdad’s naive cheat codeforces

#include using namespace std; int main() { int n,num[10]; cin>>n; num[1]=8;num[2]=4;num[3]=2;num[4]=6; if(n==0) { cout<<1<<endl; } else { n%

2016-12-27 22:13:33 391

原创 742 C. Arpa's loud Owf and Mehrdad's evil plan codeforces

思路:在这个集合中找到一共有多少的环,如果环中元素个数为奇数,则不变,为偶数,则除以2,最后求出所有环的最小公倍数。#includeusing namespace std;int pre[105],n,num;bool visit[105];void dfs(int x,int now){ if(visit[now]) { num=-1;

2016-12-27 22:07:26 445

原创 745 C. Hongcow Builds A Nation codeforces (并查集)

#includeusing namespace std;bool visit[1005];int pre[1005],num;struct node{ int flag; int num1; int num2;}arr[1005];int find(int x){ int y=x; while(y!=pre[y]) {

2016-12-23 23:22:47 346

原创 745 B. Hongcow Solves A Puzzle codeforces

#includeusing namespace std;char map1[505][505];struct node{ int l;int r; int num;}arr[505];int main(){ int n,m,flag; char x; cin>>n>>m; for(int i=1;i<=n;i++) {

2016-12-23 23:21:41 367

原创 745 A. Hongcow Learns the Cyclic Shift codeforces

#includeusing namespace std;int main(){ char str[105]; scanf("%s",str); int len=strlen(str),len1=0; for(int i=len-1;i>=0;i--) { str[i+1]=str[i]; } int l,r,l1,r1,

2016-12-23 23:20:33 445

原创 749 C. Voting codeforces

思路:每一个D(或者R)都会消除下一个离他最近的R(D),以此类推,谁先为0,谁就输,根据这个进行模拟。 #include using namespace std; char str[200005]; bool visit[200005]; int main() { int n,numd=0,numr=0; scanf("%d%s",&n,str);

2016-12-22 17:19:46 469

原创 749 B. Parallelogram is Back codeforces

#includeusing namespace std;struct node{ int x; int y;}arr[5],arr1[5],arr2[5];int main(){ for(int i=1;i<=3;i++) cin>>arr[i].x>>arr[i].y; int sum=0,visit[5]; memset(vi

2016-12-22 17:15:38 627

原创 749 A. Bachgold Problem

#includeusing namespace std;int num[500005];int main(){ int n; int sum=0; cin>>n; while(n) { if(n==1) { num[sum]++; break; }

2016-12-22 17:14:33 584

原创 746 D. Green and Black Tea codeforces

思路:先放多的,多的都是以k个连成一块,然后少的往里插。#includeusing namespace std;char str[100005];int main(){ int n,k,a,b,flag; cin>>n>>k>>a>>b; char aa,bb; aa='G';bb='B'; if(a>b) { swap(

2016-12-22 17:07:39 488

原创 746 C. Tram codeforces

三种情况:—,列车在人的后面。二,列车与人重合。三,列车宰人的前面。不同情况下比较列车与走路所耗费的时间。 #includeusing namespace std;int main(){ int s,x1,x2,t1,t2,p,d; cin>>s>>x1>>x2; cin>>t1>>t2; cin>>p>>d; if(t1>=t2) {

2016-12-22 17:04:43 512

原创 746 B. Decoding codeforces

#includeusing namespace std;int main(){ int n; char str[2005],str1[2005]; scanf("%d",&n); scanf("%s",str); int len=strlen(str); for(int i=len-1;i>=0;i--) { str[

2016-12-22 16:55:28 354

原创 746 A. Compote codeforces

#includeusing namespace std;int main(){ int a,b,c; cin>>a>>b>>c; int sum=0; for(int i=1;i<=a;i++) { if(i*2<=b&&i*4<=c) { sum=i+i*4+i*2; }

2016-12-22 16:53:05 806

原创 743C. Vladik and fractions codeforces

#includeusing namespace std;int main(){ int n; cin>>n; if(n==1) cout<<-1<<endl; else cout<<n<<' '<<n+1<<' '<<n*(n+1)<<endl; return 0;}

2016-12-15 21:19:11 395

原创 743B. Chloe and the sequence codeforces

#includetypedef long long LL;using namespace std;int main(){ LL n,k,sum,x,y,flag; cin>>n>>k; if(k%2) { cout<<1<<endl; } else { sum=0; while(k)

2016-12-15 21:17:36 281

原创 743A. Vladik and flights codeforces

#includeusing namespace std;char str[100005];int main(){ int n,a,b; cin>>n>>a>>b; for(int i=1;i<=n;i++) { cin>>str[i]; } if(str[a]!=str[b]) { cout<<1<<e

2016-12-15 21:16:37 418

原创 UVALive 7511 Multiplication Table

思路:要是没有有效元素,则是yes,若只有一个,判断他的坐标是否符合在表格中的位置,两个两个以上,则用第一个元素与其他元素作比较判断它们的相对位置符不符合表格中 的位置。#include#define MAX 1000using namespace std;struct node{ int x; int y; int v;}arr[MAX*MAX +5];i

2016-12-02 23:06:39 357

原创 uva816 Abbott’s Revenge

自己写的,测试了好多数据都行,但是WA,望大神指出错误#include#include#includeusing namespace std;int edge[10][10][5][5];int xx[10][10][5];int dir1[5][2];struct node{ int x; int y; int dir; int pi;

2016-11-29 22:40:17 530

原创 735 D. Taxes

思路:一个偶数能由两个素数组成,一个奇数能由三个素数组成,判断奇数的时候有一个特殊情况,一个奇数可以分成一个偶数一个奇数,然而2是素数,所以把奇数分成2和一个奇数,然后判断那个奇数是不是素数,是输出2,不是输出3。#includeusing namespace std;int num=0;int main(){ int n,flag; cin>>n; if(n=

2016-11-29 22:34:47 255

原创 735 B. Urbanization codeforces

#includeusing namespace std;int main(){ int n,n1,n2; int num[100005]; cin>>n>>n1>>n2; for(int i=1;i<=n;i++) { cin>>num[i]; } sort(num+1,num+1+n); double sum=

2016-11-29 22:29:51 900

原创 735 A. Ostap and Grasshopper codeforces

#includeusing namespace std;int main(){ int n,k; cin>>n>>k; string str; cin>>str; int x,y; for(int i=0;i<str.size();i++) { if(str[i]=='T') {

2016-11-29 22:29:01 414

原创 UVALive 7512 November 11th

思路:求最大值时如果空座位连的数量是奇数则x/2+1,是偶数则x/2。求最小值时每三个空座位坐一个人这样值最小。#includeusing namespace std;int map1[1005][1005],x,y,m,sum1,sum2,ans;void dfs(int i,int j){ if(j==y) return; if(!map1[i][j

2016-11-29 22:25:28 345

原创 UVALive 7500 Boxes and Balls (二分)

#includetypedef unsigned long long ull;using namespace std;int main(){ int case1=1,t; cin>>t; ull x,sum; while(t--) { cin>>x; ull l,r,mid; l=1;r=2

2016-11-29 22:22:09 345

原创 740C.Alyona and mex codeforces

题意:找的每个子数组中的未出现的最小非负整数,即mex,然后在这些mex中找到最小的那个,并且使那个mex尽可能大。求出一个符合这些条件的数组。思路:最小mex的值即所有区间里长度的最小值。求数组中每个元素的值即为他们的下标(0到n-1)对mex取余后的值,因为这样每mex个长度的数据,元素值都是从0到mex-1,这样在所有区间中所求的未出现的最小非负整数都是mex,题目上说找出符合题意的数组

2016-11-27 13:16:48 560

原创 740B Alyona and flowers codeforces

#includeusing namespace std;int num[105],num1[105],arr[105];int main(){ int n,m; cin>>n>>m; for(int i=1;i<=n;i++) { cin>>num[i]; } int sum,x,y; for(int i=1;i<=m

2016-11-27 12:41:56 498

原创 740A Alyona and copybooks codeforces

#includeusing namespace std;int main(){ long long n,a,b,c; cin>>n>>a>>b>>c; if(n%4==0) { cout<<0<<endl; } else { int rest=n%4; rest=4-rest;

2016-11-27 12:40:45 239

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除