codeforces
竟然有人也叫Webwei
这个作者很懒,什么都没留下…
展开
-
code forces 1A
Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square grani原创 2016-10-22 17:38:21 · 402 阅读 · 0 评论 -
codeforces739A. Alyona and mex
Alyona's mother wants to present an array of n non-negative integers to Alyona. The array should be special.Alyona is a capricious girl so after she gets the array, she inspects m of its subarra原创 2016-11-24 13:26:51 · 754 阅读 · 0 评论 -
codeforces 699C(广东工业大学新生杯决赛网络同步赛暨全国新生邀请赛)
这道题的题意开始看了好久也没有理解,其实就是说给你一系列数,然后要求将该序列分成连续的若干个部分,每个部分各自升序排序后组成的序列与原序列升序排序后一样,问最多分成几个部分.例如5个数分别是3 2 5 4 6.这个就会分为(3,2) ,(5,4), 6这三个部分. 思路就是前面如果有k个数,那么前面的这k个数的最大值要小于等于后面数的最小值.所以最小的数要分在第一块里面.然后这个其实也是动原创 2016-12-06 20:26:47 · 543 阅读 · 0 评论 -
codeforces 742B
#include#include#includeusing namespace std;int a[100010];int main(){ int n,x; scanf("%d%d",&n,&x); for(int i=0;i<n;i++) { scanf("%d",&a[i]); } sort(a,a+n); int k=0,l=0; long原创 2016-12-07 08:05:03 · 520 阅读 · 0 评论 -
codefroces 716B.Complete the Word
题意:给你一个字符串,然后问你是否存在一个长度为26连续子序列,它包含所有的26个字母。如果存在,则输出这个字符串,否则输出-1;#include#include#includeusing namespace std;char s[50050];int b[27];int main(){ cin>>s; int flag=true; int len=strlen(s)转载 2016-11-25 23:15:23 · 305 阅读 · 0 评论 -
codeforces781A Andryusha and Colored Balloons
题意:有个人整理袜子,这些袜子从一个口袋里面拿,一个一个的拿,然后放在桌子上,如果桌子上出现一对袜子的时候就放到柜子里面,知道所有的袜子都被放到柜子里面,问这个过程桌子上最多放几个袜子。模拟过程即可:// >File Name: CF403A.cpp// > Author: Webwei#include#include#includeusing namespace原创 2017-03-06 00:28:03 · 349 阅读 · 0 评论 -
codeforces #270题解
题目链接:http://codeforces.com/contest/472A:要求输入一个n,拆分成两个素数的和即可// >File Name: codeforces270A.cpp// > Author: Webwei#include#include#includeusing namespace std;int judge(int x){ int n原创 2017-03-21 22:26:04 · 362 阅读 · 0 评论 -
Codeforces Round #258 (Div. 2)题解
A. Game With Sticks题意:给出n,m,表示有n根水平的木棍,m根竖直的木棍,每次选取一个交点,取掉相应的两根木棍,直到不存在交点位置。// > Author: Webwei#include#includeusing namespace std;int main(){ int n,m; cin>>n>>m; int p=min(n,m); if(p%原创 2017-03-15 22:28:40 · 294 阅读 · 0 评论 -
Codeforces Round #426 (Div. 2)
A. The Useless Toy#include#define ll long long using namespace std;int main(){ ios::sync_with_stdio(0); cin.tie(0); char c1,c2; int n; cin>>c1>>c2; cin>>n; if(n%4==0){ cout<<"undefin原创 2017-07-31 11:06:50 · 270 阅读 · 0 评论 -
codeforces 967A A. Mind the Gap ( Round #477 rated, Div. 2)
题意: 告诉一系列飞机降落时间,而且降落需要1秒,相邻飞机降落必须间隔S,就是前一个飞机降落了之后(+1s)+s才可以安排下一个飞机。问多安排一个飞机的最早降落时间不知道为什么那么多人fst,好了直接上代码:// >File Name: 1.cpp// > Author: Webwei#include<bits/stdc++.h>#define ll l...原创 2018-04-30 10:05:36 · 393 阅读 · 0 评论 -
Codeforces Round #479 (Div. 3)题解 977A 977B 977C 977D 977E 977F
A. Wrong Subtraction这两句话决定了题意:(如果一个数n结尾的最后一个数字是1,就减1,是0 就去掉。问k次以后这个数是多少if the last digit of the number is non-zero, she decreases the number by one;if the last digit of the number is zero, she divides...原创 2018-05-23 09:18:07 · 350 阅读 · 0 评论 -
codeforces158B Taxi(贪心)
After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that thei-th group consists ofsi friends (1 ≤ si ≤ 4), and they want to原创 2016-12-02 17:15:04 · 764 阅读 · 0 评论 -
codeforces 231A - Team
/*就是比较一行中输入的三个数是不是大于或等于2,若满足累加器t加一*/#include#includeusing namespace std;int main(){ int n,t=0; int a[1010][3]; int sum[1010]={0}; scanf("%d",&n); for(int i=0;i<n;i++) { for(int j=0;j<3原创 2016-11-19 18:00:48 · 350 阅读 · 0 评论 -
codeforces732A A. Buy a Shovel
这道题题的大意就是你身上有一个额外的1-9的零钱和无数个10块,然后给出一个物品的价格,问买它的最少数量,其实最多超不过10,如果超多10一定是10的整数倍就一定可以,然后题中说可以用那个额外的钱也可以不用, not using the coin of r burles),具体代码如下:#include#includeusing namespace std;int main(){ i原创 2016-10-18 07:45:41 · 648 阅读 · 0 评论 -
codeforces 734A .Anton and Danik
#includeusing namespace std;char a[100010];int main(){ int N; int m=0,n=0; cin>>N; for(int i=0;i<N;i++) { cin>>a[i]; if(a[i]=='A') m++; else if(a[i]=='D') n++; } if(m>n) cout<<"Ant原创 2016-11-16 10:23:54 · 288 阅读 · 0 评论 -
codeforces 734B.Anton and Digits
Recently Anton found a box with digits in his room. There are k2 digits 2,k3 digits 3, k5 digits5 and k6 digits6.Anton's favorite integers are 32 and 256. He decided to compose this inte原创 2016-11-16 10:58:43 · 368 阅读 · 0 评论 -
codeforces733A.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原创 2016-11-01 17:42:57 · 476 阅读 · 0 评论 -
codeforces 699A Launch of Collider
There will be a launch of a new, powerful and unusual collider very soon, which located along a straight line. n particles will be launched inside it. All of them are located in a straight line and原创 2016-11-13 23:14:50 · 297 阅读 · 0 评论 -
codeforces 158A.Next Round
首先解释一下第一个样例,是参赛的人数是8个,然后要5个人,因为第五名和第六名成绩一样,所以最终要6个人。其实就是在k位置处比较一下大小,但是我做这个题的时候忽略了一点,就是0分的人是不要的,不管开始说的要几个人。就比如n=5,k=5.然后五名选手的成绩是 5 3 2 0 0,最终只会要3个人。这点需要注意,别的就没什么了,代码如下:#include#include#includeusing原创 2016-11-18 18:45:15 · 271 阅读 · 0 评论 -
codeforces 71A. Way Too Long Words
#include#includeusing namespace std;char a[105];int main(){ int n; cin>>n; while(n--) { cin>>a; if(strlen(a)<=10) cout<<a<<endl; else cout<<a[0]<<strlen(a)-2<<a[strlen(a)-1]<<endl; }原创 2016-11-18 12:33:00 · 281 阅读 · 0 评论 -
codeforces 4A.Watermelon
#includeusing namespace std;int main(){ int n; cin>>n; if(n>2&&n%2==0) cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0;}这个题中的weighs even number of kilos这句话就是说把一个瓜的重量均分成偶数原创 2016-11-18 10:49:49 · 277 阅读 · 0 评论 -
codeforces 118A.String Task
这个题直接看上去好像很麻烦,得把大写字母转化成小写字母,删除其中的元音字母,在每个辅音字母前加.,刚做这个题想了好多,的构建插入和删除函数,其实不用,元音跳过,辅音直接带点输出就好了。#include#include#includeusing namespace std;char a[105];int main(){ scanf("%s",a); for(int i=0;i原创 2016-11-18 20:47:21 · 359 阅读 · 0 评论 -
codeforces 50A . Domino piling
这个题就是说M*N的大小用2*1的牌铺,最多用多少牌,前提是不能超出这个M*N面积的大小By qq1095719690, contest: Codeforces Beta Round #47, problem: (A) Domino piling, Accepted, ##include using namespace std;int main(){ int n,m,jg;原创 2016-11-19 12:25:47 · 348 阅读 · 0 评论