Codeforces#348DIV2/VK CUP 2016
昨天第一次开大小号打cf,发现原来小号提交之后大号在此提交同样的代码会被skipped掉,然后之后提交的代码都不记分,昨天a,b,c都是水题
A
题意:问一个物品最多能被分成多少份,分成的连续两份不能相同
分析:直接1,2这样份,所以除以3乘2,在对3取模
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <set>
- #include <map>
- #include <bitset>
- #include <cmath>
- #include <queue>
- #include <stack>
- using namespace std;
- int n;
- int main()
- {
- while(cin>>n)
- {
- int h=n/;
- long long sum=h*;
- if(n%)
- cout<<sum+<<endl;
- else
- cout<<sum<<endl;
- }
- return ;
- }
B
题意:在一定范围内跳,判断最后是否会跳出范围
分析:直接模拟
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <set>
- #include <map>
- #include <bitset>
- #include <cmath>
- #include <queue>
- #include <stack>
- using namespace std;
- const int maxn=;
- const int maxm=;
- typedef struct p
- {
- char c;
- int num;
- }p;
- p s[maxn];
- int n;
- int main()
- {
- while(cin>>n)
- {
- for(int i=;i<=n;i++)
- cin>>s[i].c;
- for(int i=;i<=n;i++)
- cin>>s[i].num;
- int cnt=;
- int pos=;
- while(cnt<=maxm){
- if(s[pos].c=='>'){
- pos+=s[pos].num;
- if(pos>n) break;
- cnt++;
- }else if(s[pos].c=='<'){
- pos-=s[pos].num;
- if(pos<) break;
- cnt++;
- }
- }
- if(cnt<maxm) cout<<"FINITE"<<endl;
- else cout<<"INFINITE"<<endl;
- }
- return ;
- }
C
题意:给定一些操作,1表示指定行循环左移,2表示指定列循环上移,3表示对指定元素赋值
分析:直接模拟
- #include <iostream>
- #include <cstdio>
- #include <cstring>
- #include <string>
- #include <vector>
- #include <algorithm>
- #include <set>
- #include <map>
- #include <bitset>
- #include <cmath>
- #include <queue>
- #include <stack>
- using namespace std;
- const int maxn=;
- const int maxm=;
- int a[maxn][maxn];
- int x[maxm],y[maxm],r[maxm],c[maxm],t[maxm];
- int n,m,q;
- int main()
- {
- while(cin>>n>>m>>q)
- {
- memset(a,,sizeof(a));
- for(int i=;i<q;i++)
- {
- scanf("%d",&t[i]);
- if(t[i]==)
- {
- scanf("%d",&y[i]);
- }else if(t[i]==){
- scanf("%d",&y[i]);
- }else{
- scanf("%d%d%d",&r[i],&c[i],&x[i]);
- }
- }
- for(int i=q-;i>=;i--)
- {
- int k;
- if(t[i]==){
- a[r[i]][c[i]]=x[i];
- }else if(t[i]==){
- k=a[n][y[i]];
- for(int j=n;j>;j--)
- a[j][y[i]]=a[j-][y[i]];
- a[][y[i]]=k;
- }else{
- k=a[y[i]][m];
- for(int j=m;j>;j--)
- a[y[i]][j]=a[y[i]][j-];
- a[y[i]][]=k;
- }
- }
- for(int i=;i<=n;i++)
- {
- for(int j=;j<m;j++)
- printf("%d ",a[i][j]);
- printf("%d\n",a[i][m]);
- }
- }
- return ;
- }
Codeforces#348DIV2/VK CUP 2016的更多相关文章
- Codeforces Round VK Cup 2015 - Round 1 (unofficial online mirror, Div. 1 only)E. The Art of Dealing with ATM 暴力出奇迹!
VK Cup 2015 - Round 1 (unofficial online mirror, Div. 1 only)E. The Art of Dealing with ATM Time Lim ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D Bear and Two Paths
题目链接: http://codeforces.com/contest/673/problem/D 题意: 给四个不同点a,b,c,d,求是否能构造出两条哈密顿通路,一条a到b,一条c到d. 题解: ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C - Bear and Colors
题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 2 Edition) D. Little Artem and Dance
题目链接: http://codeforces.com/contest/669/problem/D 题意: 给你一个初始序列:1,2,3,...,n. 现在有两种操作: 1.循环左移,循环右移. 2. ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) D. Bear and Two Paths 构造
D. Bear and Two Paths 题目连接: http://www.codeforces.com/contest/673/problem/D Description Bearland has ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C. Bear and Colors 暴力
C. Bear and Colors 题目连接: http://www.codeforces.com/contest/673/problem/C Description Bear Limak has ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) B. Problems for Round 水题
B. Problems for Round 题目连接: http://www.codeforces.com/contest/673/problem/B Description There are n ...
- Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) A. Bear and Game 水题
A. Bear and Game 题目连接: http://www.codeforces.com/contest/673/problem/A Description Bear Limak likes ...
- Codeforces Round #348 (VK Cup 2016 Round 2, Div. 1 Edition) C. Little Artem and Random Variable 数学
C. Little Artem and Random Variable 题目连接: http://www.codeforces.com/contest/668/problem/C Descriptio ...
随机推荐
- iOS多线程中performSelector
下面两段代码都在主线程中运行,我们在看别人代码时会发现有时会直接调用,有时会利用performSelector调用,今天看到有人在问这个问题,我便做一下总结, [delegate imageDownl ...
- 关于Arduino 步进电机Stepper库的一些想法
官方提供了一些库,使Arduino入门起来更加快速,我们连原理都不用懂,就能通过函数控制终端.但是,这样也带来了很多的缺陷,比如,库函数的功能有限,有些无法实现.然后还有库函数因为要考虑其他的情况,你 ...
- linux的学习系列 7---管道和过滤器
有时候,我们可以把两个命令连起来使用,一个命令的输出作为另一个命令的输入,这就叫做管道.为了建立管道,需要在两个命令之间使用竖线(|)连接. 管道是Linux进程之间一种重要的通信机制:除了管道,还有 ...
- POJ 2182/暴力/BIT/线段树
POJ 2182 暴力 /* 题意: 一个带有权值[1,n]的序列,给出每个数的前面比该数小的数的个数,当然比一个数前面比第一个数小的个数是0,省略不写,求真正的序列.(拗口) 首先想到的是从前到后暴 ...
- c语言判断打开文件是否为空的方法
void writeReslut2(char* caseName,double averageTime,double max, double min,int loops,int size){ fpos ...
- Hbase shell 中能否通过filter实现的高级查询
import org.apache.hadoop.hbase.filter.CompareFilter import org.apache.hadoop.hbase.filter.SingleColu ...
- HDU2216:Game III(BFS)
Game III Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other) Total Subm ...
- C++调用java
摘要: 1 java类生成c头文件和库文件 2 对于c/c++程序,启动时先启动jvm,然后获得对应的java类的对象和方法.然后正常使用. 最近正在做一个C/C++调用java的程序,这里说的调用j ...
- 配置F5 负载均衡(转)
转自<网络运维与管理>201406-11 配置F5交换机的问题在于,与平时所学的交换机.路由器思路完全不同,拿到设备后,完全不知如何下手. 网络拓扑图如下: 两台web服务器对外提供服务, ...
- html常见标签使用
<body> <!--标题标签--> <h1></h1> <h2></h2> <h3></h3> < ...