2017多校-4
来源:互联网 发布:刻光盘软件那个好 编辑:程序博客网 时间:2024/06/04 19:44
Questionnaire
http://acm.hdu.edu.cn/showproblem.php?pid=6075
这道题居然看了半个小时,才发现有多种情况输出一种。。。所以可以直接把m看出2,k是1或0。
不管怎样都是要加大训练量的。2333
#include <iostream>#include <cstdio>#define ll long longusing namespace std;ll a[100010];int main(){ int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); int s=0; for(int i=0;i<n;i++) { scanf("%I64d",&a[i]); if(a[i]%2==0) { s++;//找偶数个数 } } if(s<(n/2))//使yes的情况大于等于no的 { printf("2 1\n"); } else { printf("2 0\n"); } } return 0;}
Time To Get Up
http://acm.hdu.edu.cn/showproblem.php?pid=6077
先将1-9的图存起来,黑边为1,白的为0。
再将给的图转换成10字符串就可以了。
#include <bits/stdc++.h>using namespace std;const string num[10]={ "1110111","0010010","1011101","1011011","0111010", "1101011","1101111","1010010","1111111","1111011"};map<string,char> cache;void build_cache(void){ for(char c='0';c<='9';c++){ cache[num[c-48]]=c; }}int main(void){ build_cache(); int t; cin>>t; string image[7]; while(t--){ for(int i=0;i<7;i++){ cin>>image[i]; } string ans,str; str+=(image[0][1]=='X'&&image[0][2]=='X')?'1':'0'; str+=(image[1][0]=='X'&&image[2][0]=='X')?'1':'0'; str+=(image[1][3]=='X'&&image[2][3]=='X')?'1':'0'; str+=(image[3][1]=='X'&&image[3][2]=='X')?'1':'0'; str+=(image[4][0]=='X'&&image[5][0]=='X')?'1':'0'; str+=(image[4][3]=='X'&&image[5][3]=='X')?'1':'0'; str+=(image[6][1]=='X'&&image[6][2]=='X')?'1':'0'; ans+=cache[str];str.clear(); str+=(image[0][6]=='X'&&image[0][7]=='X')?'1':'0'; str+=(image[1][5]=='X'&&image[2][5]=='X')?'1':'0'; str+=(image[1][8]=='X'&&image[2][8]=='X')?'1':'0'; str+=(image[3][6]=='X'&&image[3][7]=='X')?'1':'0'; str+=(image[4][5]=='X'&&image[5][5]=='X')?'1':'0'; str+=(image[4][8]=='X'&&image[5][8]=='X')?'1':'0'; str+=(image[6][6]=='X'&&image[6][7]=='X')?'1':'0'; ans+=cache[str];str.clear(); ans+=":"; str+=(image[0][1+12]=='X'&&image[0][2+12]=='X')?'1':'0'; str+=(image[1][0+12]=='X'&&image[2][0+12]=='X')?'1':'0'; str+=(image[1][3+12]=='X'&&image[2][3+12]=='X')?'1':'0'; str+=(image[3][1+12]=='X'&&image[3][2+12]=='X')?'1':'0'; str+=(image[4][0+12]=='X'&&image[5][0+12]=='X')?'1':'0'; str+=(image[4][3+12]=='X'&&image[5][3+12]=='X')?'1':'0'; str+=(image[6][1+12]=='X'&&image[6][2+12]=='X')?'1':'0'; ans+=cache[str];str.clear(); str+=(image[0][1+17]=='X'&&image[0][2+17]=='X')?'1':'0'; str+=(image[1][0+17]=='X'&&image[2][0+17]=='X')?'1':'0'; str+=(image[1][3+17]=='X'&&image[2][3+17]=='X')?'1':'0'; str+=(image[3][1+17]=='X'&&image[3][2+17]=='X')?'1':'0'; str+=(image[4][0+17]=='X'&&image[5][0+17]=='X')?'1':'0'; str+=(image[4][3+17]=='X'&&image[5][3+17]=='X')?'1':'0'; str+=(image[6][1+17]=='X'&&image[6][2+17]=='X')?'1':'0'; ans+=cache[str];str.clear(); cout<<ans<<endl; } return 0;}
阅读全文
0 0
- 2017多校-4
- 2017 多校4 1009 Questionnaire
- 2017 多校4 1003 Counting Divisors
- 【2017多校 #Round 4 T7】【HDU6073】Matching In Multiplication
- Counting Divisors (2017 多校4)“素 数 筛”
- 2017多校4 1011 Time To Get Up
- 2017 多校 水题
- 2017多校-1
- 2017多校 Balala Power!
- 2017 多校 TrickGCD
- 2017多校-2
- 2017多校-3
- 2017多校-5
- 2017多校-6
- 2017多校7-三道水题
- 2017多校-7
- 2017多校-8
- 2017多校-9
- 理解Java线程的中断
- 283. Move Zeroes
- 设计模式之状态模式
- 类和对象
- UNIX的并发机制
- 2017多校-4
- 支持向量机(SVM)
- Lintcode 第一个错误版本
- Mysql中now()和sysdate()的区别
- 字符串练习
- 响应式的车牌登记页面
- IntelliJ Idea 2017 免费激活方法
- 数组
- python打飞机小程序