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 ...
随机推荐
- Mishka and Interesting sum
Mishka and Interesting sum time limit per test 3.5 seconds memory limit per test 256 megabytes input ...
- %3f URL --> '?'拼接引发的问题
转载自:https://www.reddit.com/r/swift/comments/2w19kp/how_do_you_send_a_through_nsmutableurlrequest/ ho ...
- Java中常见的5种WEB服务器介绍
这篇文章主要介绍了Java中常见的5种WEB服务器介绍,它们分别是Tomcat.Resin.JBoss.WebSphere.WebLogic,需要的朋友可以参考下 Web服务器是运行及发布Web应用的 ...
- socket常见几种异常
第1个异常是 java.net.BindException:Address already in use: JVM_Bind. 该异常发生在服务器端进行newServerSocket(port)(po ...
- 使用命令行编译as文件成swf
设置环境变量到flex sdk的目录下.如:D:\Program Files\Adobe Flash Builder 4.5\sdks\flex_sdk_4.6\bin 找到flex-config.x ...
- angularJS 判断
判断语句: ng-switch on ng-switch-when ng-switch-when ng-if=”person.sex==1“ <ul> <li ng-repeat=” ...
- codeforces 558/C Amr and Chemistry(数论+位运算)
题目链接:http://codeforces.com/problemset/problem/558/C 题意:把n个数变成相同所需要走的最小的步数易得到结论,两个奇数不同,一直×2不可能有重叠枚举每个 ...
- 如何让Spring MVC接收的参数可以转换为java对象
场景: web.xml中增加了一个DispatcherServlet配置,并在同级目录下添加了**-servlert.xml文件,搭建起了一个spring mvc的restful访问接口. 问题描述: ...
- hdu_5738_Eureka(脑洞)
题目链接:hdu_5738_Eureka 题意: 这题感觉说不清楚,坑点有点坑,一不小心就会推出错误的公式,然后最重要的是你还不知道你推错了 题解: 这里贴一个官方的题解 Eureka xjb推导一下 ...
- nginx初级安装配置
nginx初级安装配置 转自:(lykyl原创)http://www.cnblogs.com/lykyl/archive/2012/11/21/2781077.html 实验环境:系统 CENTOS5 ...