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 ...
随机推荐
- ALAssetsLibrary 照片相关 浅析
ALAssetsLibrary 提供了访问iOS设备下”照片”应用下所有照片和视频的接口: 从 ALAssetsLibrary 中可读取所有的相册数据,即 ALAssetsGroup 对象列表: 从每 ...
- sql 日结
--生成日结数据 ==================================== -- Author: <Author,,Name> -- Create date: <Cr ...
- 转:Loadrunner——Block(块)技术
在使用LoadRunner时经常遇到这样一个问题,如果对不同的事务进行不同次数的循环该怎么处理?默认情况下LR对所有的事务都是统一执行的,即虽然有多个事务,但它们被执行的循环次数都是一样的,那么LR如 ...
- linux 命令实现原理
我们知道有些Linux的命令涉及到一些高效率的算法,在此做出一个积累吧,不是系统的. 1.tail命令打印一个文件的最后num行 2.grep命令从文本中匹配字符串 基于正则表达式的匹配很快. it ...
- java下发电子邮件demo
在实际项目中会遇到需要使用邮件注册,或者是使用邮件找回密码等操作,需要使用到邮件发送功能. 其实邮件的发送主要是依赖于邮件协议,只要能实现邮件协议,那么发送邮件其实还是很容易的.这一步java类库已经 ...
- O(n)线性时间找第K大,中位数
运用快速排序的思想,可以达到线性时间找到一串数的第K大 #include<cstdio> #define F(i,a,b) for(int i=a;i<=b;i++) ],n; vo ...
- Struts2 语法--验证方式:
第一种方式: 重写validation方法, ====验证action中所有的方法: 1. 在UserAction1里重写validation: @Override public void valid ...
- Excel相关问题
Excel默认永远使用最后安装的那个Excel版本打开.但是如果有一个Excel已经启动了,则使用那个Excel打开. 1.打开“开发工具”选项卡2007中:[Excel选项]-[常用]2010中:[ ...
- 面向对象重写(override)与重载(overload)区别
一.重写(override) override是重写(覆盖)了一个方法,以实现不同的功能.一般是用于子类在继承父类时,重写(重新实现)父类中的方法. 重写(覆盖)的规则: 1.重写方法的参数列表必须完 ...
- UIImage将图片写入本地相册
UIImageWriteToSavedPhotosAlbum(<#UIImage *image#>, <#id completionTarget#>, <#SEL com ...