CodeForces 660B Seating On Bus】的更多相关文章

模拟. #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<algorithm> using namespace std; int main() { int n,m; scanf("%d%d",&n,&m); ;i<=*n;i++) { *n+i<=m) printf(*n+i); if(i<…
题目链接: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each ro…
B. Seating On Bus 题目连接: http://www.codeforces.com/contest/660/problem/B Description Consider 2n rows of the seats in a bus. n rows of the seats on the left and n rows of the seats on the right. Each row can be filled by two people. So the total capac…
地址:http://codeforces.com/contest/660/problem/B 题目: B. Seating On Bus time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Consider 2n rows of the seats in a bus. n rows of the seats on the left…
 Co-prime Array Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 660A Description You are given an array of n elements, you must make it a co-prime array in as few moves as possible. In e…
inputstandard inputoutputstandard outputIt is raining heavily. But this is the first day for Serval, who just became 3 years old, to go to the kindergarten. Unfortunately, he lives far from kindergarten, and his father is too busy to drive him there.…
题意:给定一个2*N的方格,从左上角开始走,有些格子不能走,问能否一次遍历所有能走的方格 在Gym上看到一场香港的比赛,很好奇就去看了一下,发现第一题很有趣,并且很水,似乎讨论一下奇偶性就行了,然后...我Wa了五次... 主要是以下三种情况比较坑: #include<bits/stdc++.h> using namespace std; #define MAXN 100000+10 struct point{int x,y;}p[MAXN]; int n,m,tot; bool cmp(po…
题意:一辆车在一条路上行驶,给你路的总长度a,油箱的容量b,加油站在距离起点的距离f,以及需要走多少遍这条路k(注意:不是往返) 问你最少加多少次油能走完. Examples Input 6 9 2 4 Output 4 Input 6 10 2 4 Output 2 Input 6 5 4 3 Output -1 思路:把需要走的路程拉直来看,那么相邻两次经过加油站之间的路程为2*f或2*(a-f),再加上一些特判就好了. 代码:#include<iostream>#include<s…
行和列>4的可以直接构造,只要交叉着放就好了,比如1 3 5 2 4和2 4 1 3 5,每一行和下一行用不同的方法就能保证没有邻居. 其他的可以用爆搜,每次暴力和后面的一个编号交换并判断可行性. 写dfs的话其实行和列>4的就不用刻意构造了,这个dfs方法可以$O(n*m)$跑出一个构造方案. #include<iostream> #include<cstring> #include<cstdlib> #include<cstdio> #def…
A. Co-prime Array http://codeforces.com/contest/660/problem/A 题意:给出一段序列,插进一些数,使新的数列两两成互质数,求插最少的个数,并输出这个序列. 思路:最优的就是插入1,1与非1的数都互质. #include<bits/stdc++.h> using namespace std; int gcd(int a,int b){ ?a:gcd(b,a%b); } int main(){ ,a[],b[]; scanf("%…