【模拟与阅读理解】Gym - 101954C Rullete
http://codeforces.com/gym/101954/problem/C
题意:14行伪代码让你翻译。
坑得yibi
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<algorithm>
#include<iostream>
#include<math.h>
#include<ctime>
#include<string>
#include<vector>
using namespace std;
typedef long long ll;
const int MAXN = 1e5 + ;
const int maxn = MAXN;
const long long MOD = 1e9 + ;
#define rep(i,t,n) for(int i =(t);i<=(n);++i)
#define per(i,n,t) for(int i =(n);i>=(t);--i)
#define mmm(a,b) memset(a,b,sizeof(a))
//#define x first
//#define y second void smain();
#define ONLINE_JUDGE
int main() { ios::sync_with_stdio(false);
#ifndef ONLINE_JUDGE
FILE *myfile;
myfile = freopen("C:\\Users\\acm-14\\Desktop\\test\\b.in", "r", stdin);
if (myfile == NULL)
fprintf(stdout, "error on input freopen\n");
FILE *outfile;
outfile = freopen("C:\\Users\\acm-14\\Desktop\\test\\out.txt", "w", stdout);
if (outfile == NULL)
fprintf(stdout, "error on output freopen\n");
long _begin_time = clock();
#endif
smain();
#ifndef ONLINE_JUDGE
long _end_time = clock();
printf("time = %ld ms.", _end_time - _begin_time);
#endif
return ;
} string cards[];
int cval[];
char ctyp[];
string crk[];
int typ[];
/*2D 5D JD KC AC*/
int score = ;
int cntmod = ;
void fff(int x) {
if (x == ) {
score++;
int tmp = ;
rep(i, , )if (crk[i] == "J")tmp++;
score += tmp * cval[];
}
if (x == ) {
//int last = score;
rep(i, , ) {
typ[ctyp[i]]++;
}
rep(i, , )if (typ[i] >= ) { score *= ; break; }
//if (last != score)cntmod++, lastmod = 2;
}
if (x == ) { //last = score;
if (typ['C'] > && typ['S'] > && typ['H'] > && typ['D'] > )score *= ;
//if (last != score)cntmod++, lastmod = 3;
}
if (x == ) {
//last = score;
score += abs(typ['C'] + typ['S'] - typ['H'] - typ['D']);
// if (last != score)cntmod++, lastmod = 4;
}
if (x == ) {
//last = score;
if (score % == ) {
int t = ;
rep(i, , score) {
if (score%i == )t += i;
}
score += t;
}
//if (last != score)cntmod++, lastmod = 5;
}//
if (x == ) {
//last = score;
int cnt7 = ;
rep(i, , )if (cval[i] == )cnt7++;
if (cnt7 == )score -= * ;
//if (last != score)cntmod++, lastmod = 6;
}
//
if (x == ) {
//last = score;
if (score >= ) {
int mn = ;
rep(i, , )mn = min(mn, cval[i]);
score += mn;
}
//if (last != score)cntmod++, lastmod = 7;
}//
if (x == ) {
//last = score;
if (score < )score *= -;
//if (last != score)cntmod++, lastmod = 8;
}//
if (x == ) {
//last = score;
if (typ['D'] >= ) {
score += ;
rep(i, , ) {
if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
else if (cval[i] == )cval[i] = , crk[i] = '';
}
}
//if (last != score)cntmod++, lastmod = 9;
}//
if (x == ) {
//last = score;
int a[];
int cnta = ;
rep(i, , ) {
if (crk[i] >= ""&&crk[i] <= "")a[i] = crk[i][] - '';
if (crk[i].length() == )a[i] = ;
if (crk[i] == "A")a[i] = , cnta++;;
if (crk[i] == "J")a[i] = ;
if (crk[i] == "Q")a[i] = ;
if (crk[i] == "K")a[i] = ;
}
sort(a + , a + + );
int f = ;
rep(i, , )if (a[i] != a[i + ] - )f = ; if ( f)score += cnta * ;
//if (last != score)cntmod++, lastmod = 10;
}//
if (x == ) {
//last = score;
if (cntmod > ) {
int x = score;
while (x) {
score += x & ;
x >>= ;
}
//score += __builtin_popcount(8);
}
//if (last != score)cntmod++, lastmod = 11;
}
}
void smain()
{
rep(i, , ) {
cin >> cards[i];
if (cards[i][] >= ''&&cards[i][] <= '')cval[i] = cards[i][] - '';
else cval[i] = ;
if (cards[i].length() == )cval[i] = , ctyp[i] = cards[i][],crk[i]="";
else ctyp[i] = cards[i][],crk[i]=cards[i][]; } rep(i, , )score += cval[i]; int lastmod = ;
//
score++; cntmod++;
int tmp = ;
rep(i, , )if (crk[i] == "J")tmp++;
score += tmp * cval[];
//
int last = score;
rep(i, , ) {
typ[ctyp[i]]++;
}
rep(i, , )if (typ[i] >= ) { score *= ; break; }
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (typ['C'] > && typ['S'] > && typ['H'] > && typ['D'] > )score *= ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
score += abs(typ['C'] + typ['S'] - typ['H'] - typ['D']);
if (last != score)cntmod++,lastmod = ;
//
last = score;
if (score % == ) {
int t = ;
rep(i, , score) {
if (score%i == )t += i;
}
score += t;
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
int cnt7 = ;
rep(i, , )if (cval[i] == )cnt7++;
if (cnt7 == )score -= * ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (score >= ) {
int mn = ;
rep(i, , )mn = min(mn, cval[i]);
score += mn;
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (score < )score *= -;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (typ['D'] >= ) {
score += ;
rep(i, , ) {
if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
else if (cval[i] == )cval[i] = , crk[i] = "";
}
}
if (last != score)cntmod++, lastmod = ;
//
last = score;
int a[];
int cnta=;
rep(i, , ) {
if (crk[i] >= ""&&crk[i] <= "")a[i] = crk[i][] - '';
if (crk[i].length() == )a[i] = ;
if (crk[i] == "A")a[i] = , cnta++;;
if (crk[i] == "J")a[i] = ;
if (crk[i] == "Q")a[i] = ;
if (crk[i] == "K")a[i] = ;
}
sort(a + , a + + );
int f = ;
rep(i, , )if (a[i] != a[i + ] - )f = ; if (f)score += cnta * ;
if (last != score)cntmod++, lastmod = ;
//
last = score;
if (cntmod > ) {
int x = score;
while (x) {
score += x & ;
x >>= ;
}
//score += __builtin_popcount(8);
}
if (last != score)cntmod++, lastmod = ;
//
rep(i, , ) {
if (cval[i] == ) {
fff(lastmod);
break;
}
}
//
rep(i, , ) {
if (cval[i] == ) {
if(score>=) { score *= ; break; } }
}
cout << score << endl; //int n;
//cin >> n;
}
/*,
o:o
:o:
o:o
33333333333
QC 8D JD 10S 9D
2D 5D JD KC AC
*/
【模拟与阅读理解】Gym - 101954C Rullete的更多相关文章
- HTTPS强制安全策略-HSTS协议阅读理解
https://developer.mozilla.org/en-US/docs/Web/Security/HTTP_strict_transport_security [阅读理解式翻译,非严格遵循原 ...
- Codeforces#543 div2 A. Technogoblet of Fire(阅读理解)
题目链接:http://codeforces.com/problemset/problem/1121/A 真·阅读理解 题意就是 有n个人 pi表示他们的强度 si表示他们来自哪个学校 现在Arkad ...
- 用Keras搞一个阅读理解机器人
catalogue . 训练集 . 数据预处理 . 神经网络模型设计(对话集 <-> 问题集) . 神经网络模型设计(问题集 <-> 回答集) . RNN神经网络 . 训练 . ...
- Tensorflow做阅读理解与完形填空
catalogue . 前言 . 使用的数据集 . 数据预处理 . 训练 . 测试模型运行结果: 进行实际完形填空 0. 前言 开始写这篇文章的时候是晚上12点,突然想到几点新的理解,赶紧记下来.我们 ...
- P3879 [TJOI2010]阅读理解 题解
P3879 [TJOI2010]阅读理解 题解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输 ...
- 阅读关于DuReader:百度大规模的中文机器阅读理解数据集
很久之前就得到了百度机器阅读理解关于数据集的这篇文章,今天才进行总结!.... 论文地址:https://arxiv.org/abs/1711.05073 自然语言处理是人工智能皇冠上的明珠,而机器阅 ...
- Trie树【P3879】 [TJOI2010]阅读理解
Description 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. Input 第一行为整数N,表示短文 ...
- Trie树【洛谷P3879】 [TJOI2010]阅读理解
P3879 [TJOI2010]阅读理解 题目描述 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. 输入输出 ...
- P3879 [TJOI2010]阅读理解
\(\color{#0066ff}{ 题目描述 }\) 英语老师留了N篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. \( ...
随机推荐
- app优化之流量节省
前言:“客户端上传时间戳”的玩法,你玩过么?一起聊聊时间戳的奇技淫巧!,其实这个类似于数据版本号的东西. 缘起:无线时代,流量敏感.APP在登录后,往往要向服务器同步非常多的数据,很费流量,技术上有没 ...
- MySQL查询库和表占用的硬盘空间大小
在mysql中有一个默认的数据表information_schema,information_schema这张数据表保存了MySQL服务器所有数据库的信息.如数据库名,数据库的表,表栏的数据类型与访问 ...
- [k8s]Docker 用户使用 kubectl 命令指南-unkown排错(kubelet端口解析)
参考:https://kubernetes.io/docs/user-guide/kubectl-cheatsheet/ https://k8smeetup.github.io/docs/user-g ...
- 织梦dedecms移动版设置二级域名的方法 织梦如何设置m.开头的域名
dedecms/' target='_blank'>织梦dedecms建站系统自从2015.06.18号升级后,系统增加了最强的手机站功能,模板与PC模板分开,标签90%类似,数据同步,很牛很强 ...
- win10 Faster-RCNN训练自己数据集遇到的问题集锦 (转)
题注: 在win10下训练实在是有太多坑了,在此感谢网上的前辈和大神,虽然有的还会把你引向另一个坑~~. 最近,用faster rcnn跑一些自己的数据,数据集为某遥感图像数据集——RSOD,标注格式 ...
- 关于QQ邮箱有时候接受不到邮件的解决
1.很可能是被当作垃圾邮件拦截了,这时候就要自己找回 2.首先点击邮箱首页 3.在最后一行倒数第三个选择自助查询 4.一般在收信查询或者删信查询里面,找到被删的邮件,添加到白名单就好了
- Houdini 过程化地形系统(二):基于UE4的FC5植被系统(1)
背景 通过之前的几篇分析实践,已经基本打通了UE4的Houdini植被管线部分,并对Far Cry5(简称FC5)的植被系统的需求做了整理,在接下来的几节中,会关注于如何使用Houdini基于UE4来 ...
- minicom for Mac 配置
安装:brew install minicom 配置: 串口是:dev/tty.usbserial minicons -s 配置一下: 流控要关掉,不然输入不了
- Mysql分组查询group by语句详解
(1) group by的含义:将查询结果按照1个或多个字段进行分组,字段值相同的为一组(2) group by可用于单个字段分组,也可用于多个字段分组 select * from employee; ...
- DeBug Python代码全靠print函数?换用这个一天2K+Star的工具吧,改进版
pysnooper是代码debug神器,比无限low print好很多和也比日志debug好一些,比断点调试也好一些,这个很犀利的装饰器. https://www.toutiao.com/a66829 ...