昨天第一次开大小号打cf,发现原来小号提交之后大号在此提交同样的代码会被skipped掉,然后之后提交的代码都不记分,昨天a,b,c都是水题

A

题意:问一个物品最多能被分成多少份,分成的连续两份不能相同

分析:直接1,2这样份,所以除以3乘2,在对3取模

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <string>
  5. #include <vector>
  6. #include <algorithm>
  7. #include <set>
  8. #include <map>
  9. #include <bitset>
  10. #include <cmath>
  11. #include <queue>
  12. #include <stack>
  13. using namespace std;
  14. int n;
  15. int main()
  16. {
  17. while(cin>>n)
  18. {
  19. int h=n/;
  20. long long sum=h*;
  21. if(n%)
  22. cout<<sum+<<endl;
  23. else
  24. cout<<sum<<endl;
  25. }
  26. return ;
  27. }

B

题意:在一定范围内跳,判断最后是否会跳出范围

分析:直接模拟

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <string>
  5. #include <vector>
  6. #include <algorithm>
  7. #include <set>
  8. #include <map>
  9. #include <bitset>
  10. #include <cmath>
  11. #include <queue>
  12. #include <stack>
  13. using namespace std;
  14. const int maxn=;
  15. const int maxm=;
  16. typedef struct p
  17. {
  18. char c;
  19. int num;
  20. }p;
  21. p s[maxn];
  22. int n;
  23. int main()
  24. {
  25. while(cin>>n)
  26. {
  27. for(int i=;i<=n;i++)
  28. cin>>s[i].c;
  29. for(int i=;i<=n;i++)
  30. cin>>s[i].num;
  31. int cnt=;
  32. int pos=;
  33. while(cnt<=maxm){
  34. if(s[pos].c=='>'){
  35. pos+=s[pos].num;
  36. if(pos>n) break;
  37. cnt++;
  38. }else if(s[pos].c=='<'){
  39. pos-=s[pos].num;
  40. if(pos<) break;
  41. cnt++;
  42. }
  43. }
  44. if(cnt<maxm) cout<<"FINITE"<<endl;
  45. else cout<<"INFINITE"<<endl;
  46. }
  47. return ;
  48. }

C

题意:给定一些操作,1表示指定行循环左移,2表示指定列循环上移,3表示对指定元素赋值

分析:直接模拟

  1. #include <iostream>
  2. #include <cstdio>
  3. #include <cstring>
  4. #include <string>
  5. #include <vector>
  6. #include <algorithm>
  7. #include <set>
  8. #include <map>
  9. #include <bitset>
  10. #include <cmath>
  11. #include <queue>
  12. #include <stack>
  13. using namespace std;
  14. const int maxn=;
  15. const int maxm=;
  16. int a[maxn][maxn];
  17. int x[maxm],y[maxm],r[maxm],c[maxm],t[maxm];
  18. int n,m,q;
  19. int main()
  20. {
  21. while(cin>>n>>m>>q)
  22. {
  23. memset(a,,sizeof(a));
  24. for(int i=;i<q;i++)
  25. {
  26. scanf("%d",&t[i]);
  27. if(t[i]==)
  28. {
  29. scanf("%d",&y[i]);
  30. }else if(t[i]==){
  31. scanf("%d",&y[i]);
  32. }else{
  33. scanf("%d%d%d",&r[i],&c[i],&x[i]);
  34. }
  35. }
  36. for(int i=q-;i>=;i--)
  37. {
  38. int k;
  39. if(t[i]==){
  40. a[r[i]][c[i]]=x[i];
  41. }else if(t[i]==){
  42. k=a[n][y[i]];
  43. for(int j=n;j>;j--)
  44. a[j][y[i]]=a[j-][y[i]];
  45. a[][y[i]]=k;
  46. }else{
  47. k=a[y[i]][m];
  48. for(int j=m;j>;j--)
  49. a[y[i]][j]=a[y[i]][j-];
  50. a[y[i]][]=k;
  51.  
  52. }
  53. }
  54. for(int i=;i<=n;i++)
  55. {
  56. for(int j=;j<m;j++)
  57. printf("%d ",a[i][j]);
  58. printf("%d\n",a[i][m]);
  59. }
  60. }
  61.  
  62. return ;
  63. }

Codeforces#348DIV2/VK CUP 2016的更多相关文章

  1. 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 ...

  2. 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. 题解: ...

  3. Codeforces Round #351 (VK Cup 2016 Round 3, Div. 2 Edition) C - Bear and Colors

    题目链接: http://codeforces.com/contest/673/problem/C 题解: 枚举所有的区间,维护一下每种颜色出现的次数,记录一下出现最多且最小的就可以了. 暴力n*n. ...

  4. 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. ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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 ...

随机推荐

  1. iOS多线程中performSelector

    下面两段代码都在主线程中运行,我们在看别人代码时会发现有时会直接调用,有时会利用performSelector调用,今天看到有人在问这个问题,我便做一下总结, [delegate imageDownl ...

  2. 关于Arduino 步进电机Stepper库的一些想法

    官方提供了一些库,使Arduino入门起来更加快速,我们连原理都不用懂,就能通过函数控制终端.但是,这样也带来了很多的缺陷,比如,库函数的功能有限,有些无法实现.然后还有库函数因为要考虑其他的情况,你 ...

  3. linux的学习系列 7---管道和过滤器

    有时候,我们可以把两个命令连起来使用,一个命令的输出作为另一个命令的输入,这就叫做管道.为了建立管道,需要在两个命令之间使用竖线(|)连接. 管道是Linux进程之间一种重要的通信机制:除了管道,还有 ...

  4. POJ 2182/暴力/BIT/线段树

    POJ 2182 暴力 /* 题意: 一个带有权值[1,n]的序列,给出每个数的前面比该数小的数的个数,当然比一个数前面比第一个数小的个数是0,省略不写,求真正的序列.(拗口) 首先想到的是从前到后暴 ...

  5. c语言判断打开文件是否为空的方法

    void writeReslut2(char* caseName,double averageTime,double max, double min,int loops,int size){ fpos ...

  6. Hbase shell 中能否通过filter实现的高级查询

    import org.apache.hadoop.hbase.filter.CompareFilter import org.apache.hadoop.hbase.filter.SingleColu ...

  7. HDU2216:Game III(BFS)

    Game III Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total Subm ...

  8. C++调用java

    摘要: 1 java类生成c头文件和库文件 2 对于c/c++程序,启动时先启动jvm,然后获得对应的java类的对象和方法.然后正常使用. 最近正在做一个C/C++调用java的程序,这里说的调用j ...

  9. 配置F5 负载均衡(转)

    转自<网络运维与管理>201406-11 配置F5交换机的问题在于,与平时所学的交换机.路由器思路完全不同,拿到设备后,完全不知如何下手. 网络拓扑图如下: 两台web服务器对外提供服务, ...

  10. html常见标签使用

    <body> <!--标题标签--> <h1></h1> <h2></h2> <h3></h3> < ...