题意:给定 n 首诗,然后让你给他打分,有四种规则,第一种是按音节打,如果音节在8-12之间,就加10,第二种就是按押韵打,如果13,24一个押韵就加20分。

第三种按音节数打,13,24有一个一样的就加10分,第四种是扣分的,如果多于4段,扣10分。

析:按照他说的来,就好,这个输入就挺恶心的,好难处理,而且一种很变态的数据就是标点后面没有空格,你还得自己去判断。。。

代码如下:

#pragma comment(linker, "/STACK:1024000000,1024000000")
#include <cstdio>
#include <string>
#include <cstdlib>
#include <cmath>
#include <iostream>
#include <cstring>
#include <set>
#include <queue>
#include <algorithm>
#include <vector>
#include <map>
#include <cctype>
#include <cmath>
#include <stack>
#include <sstream>
#define frer freopen("in.txt", "r", stdin)
#define frew freopen("out.txt", "w", stdout)
using namespace std; typedef long long LL;
typedef pair<int, int> P;
const int INF = 0x3f3f3f3f;
const double inf = 0x3f3f3f3f3f3f;
const double PI = acos(-1.0);
const double eps = 1e-8;
const int maxn = 1e2 + 5;
const int mod = 1e9 + 7;
const char *mark = "+-*";
const int dr[] = {-1, 0, 1, 0};
const int dc[] = {0, 1, 0, -1};
const char *de[] = {"0000", "0001", "0010", "0011", "0100", "0101", "0110", "0111", "1000", "1001", "1010", "1011", "1100", "1101", "1110", "1111"};
int n, m;
const int mon[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int monn[] = {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
inline int Min(int a, int b){ return a < b ? a : b; }
inline int Max(int a, int b){ return a > b ? a : b; }
inline LL Min(LL a, LL b){ return a < b ? a : b; }
inline LL Max(LL a, LL b){ return a > b ? a : b; }
inline bool is_in(int r, int c){
return r >= 0 && r < n && c >= 0 && c < m;
}
int a[500];
bool b[500];
bool c[500];
vector<string> v[500];
int ans[10]; int main(){
int T; cin >> T;
for(int kase = 1; kase <= T; ++kase){
int cnt = 0;
string s;
for(int i = 0; i < 500; ++i) v[i].clear();
while(true){
cin >> s;
bool ok = false, ok1 = false;
if(s[s.size()-1] == ',') s.resize(s.size()-1), ok1 = true;
if(s[s.size()-1] == '.') ok = true, s.resize(s.size()-1);
for(int i = 0; i < s.size(); ++i) if(s[i] == ',') s[i] = ' ';
stringstream ss(s);
int x = 0;
while(ss >> s){
if(x) ++cnt; v[cnt].push_back(s);
++x;
}
if(ok1) ++cnt;
if(ok) break;
} memset(ans, 0, sizeof ans);
memset(a, 0, sizeof a);
for(int i = 0; i <= cnt; ++i){
a[i] = 0;
for(int j = 0; j < v[i].size(); ++j){
int len = v[i][j].size();
if(len == 6){
s = v[i][j];
bool ok = false;
for(int k = 0; k < s.size(); ++k){
if(k+1 < s.size() && s[k] == 'n' && s[k+1] == 'g'){ a[i] += 2; ok = true; break; }
else if(k+1 < s.size() && s[k] == 'n' && s[k+1] == 'y'){ a[i] += 2; ok = true; break; }
}
if(!ok) a[i] += 3;
}
else if(len > 6) a[i] += 3;
else if(len == 4 || len == 5) a[i] += 2;
else if(len == 3){
s = v[i][j];
if(towlower(s[0]) == 'a' || towlower(s[0]) == 'e' || towlower(s[0]) == 'o' || towlower(s[0]) == 'i' || towlower(s[0]) == 'u') a[i] += 2;
else ++a[i];
}
else ++a[i];
}
} for(int i = 0; i < 4; ++i)
if(a[i] >= 8 && a[i] <= 12) ans[1] += 10; if(cnt >= 3){
string s1 = v[0][v[0].size()-1], s2 = v[1][v[1].size()-1], s3 = v[2][v[2].size()-1], s4 = v[3][v[3].size()-1];
if(s1[s1.size()-2] == s3[s3.size()-2] && s1[s1.size()-1] == s3[s3.size()-1]) ans[2] += 20;
if(s2[s2.size()-2] == s4[s4.size()-2] && s2[s2.size()-1] == s4[s4.size()-1]) ans[2] += 20;
}
else if(cnt == 2){
string s1 = v[0][v[0].size()-1], s2 = v[1][v[1].size()-1], s3 = v[2][v[2].size()-1];
if(s1[s1.size()-2] == s3[s3.size()-2] && s1[s1.size()-1] == s3[s3.size()-1]) ans[2] += 20;
} if(a[2] && a[0] == a[2]) ans[3] += 10;
if(a[1] && a[3] && a[1] == a[3]) ans[3] += 10;
for(int i = 4; i <= cnt; ++i) ans[4] += 10;
ans[5] = ans[1] + ans[2] + ans[3] - ans[4];
printf("Case #%d: %d %d %d %d %d\n", kase, ans[1], ans[2], ans[3], ans[4], ans[5]);
}
return 0;
}

  

UVaLive 6805 Pantun Grader (恶心的模拟)的更多相关文章

  1. UVALive 4222 /HDU 2961 Dance 大模拟

    Dance Problem Description For a dance to be proper in the Altered Culture of Machinema, it must abid ...

  2. UVALive 6269 Digital Clock --枚举,模拟

    题意:说不清楚,自己看吧,太恶心. 这题真是SB了,当时看了一下以为乱搞就好了,于是开始动手拍,结果拍了好几个小时都没拍出来,而且越想越想不通,直接把自己绕进去了,结果gg了. 总结:甭管什么题,想清 ...

  3. UVALive 5880 Vigenère Cipher Encryption (模拟)

    Stack Machine Executor 题目链接: http://acm.hust.edu.cn/vjudge/problem/26628 Description http://7xjob4.c ...

  4. UVALive 6884 GREAT + SWERC = PORTO dfs模拟

    题目连接: https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show ...

  5. UVALive 2517 Moving Object Recognition(模拟)

    题目看上去很吓人,很高端,但其实很简单,不要被吓到,照搬题目的公式就可以了. 方法:用BFS求出最大块和重心,找出题目公式需要的未知量,然后套到题目公式里就可以求出答案了. 代码: #include& ...

  6. hdu 4964 恶心模拟

    http://acm.hdu.edu.cn/showproblem.php?pid=4964 给定语句,按照语法翻译html并输出. 就是恶心的模拟,递归搞就行了 处理id和class时,在一个'&g ...

  7. 模拟赛1029d1

    第二题[题目描述]给你两个日期,问这两个日期差了多少毫秒.[输入格式]两行,每行一个日期,日期格式保证为"YYYY-MM-DD hh:mm:ss"这种形式.第二个日期时间一定比第一 ...

  8. Hdu3640-I, zombie(模拟+二分)

    The "endless" model in "I, zombie" of "Plants vs. Zombies" is my favou ...

  9. HUNNU11342:Chemistry(模拟)

    http://acm.hunnu.edu.cn/online/?action=problem&type=show&id=11342 Problem description The ch ...

随机推荐

  1. BZOJ 2151 种树

    贪心+priority_queue. #include<iostream> #include<cstdio> #include<cstring> #include& ...

  2. 优雅地使用CodeIgniter 3之Session类库(1)(转)

    相信无数人在使用CI2的Session类库时,遇到各种的坑,各种抱怨,各种不解.在CI中国论坛能搜到大量关于Session类库的提问,说明要想用 好session类库还是得下一番功夫.本文将先从CI2 ...

  3. session_start保存的客户端cookie的值什么时候改变

    //cookie记录的session_id立刻改变了session_start();echo "old:".session_id();session_regenerate_id() ...

  4. 【英语】Bingo口语笔记(61) - mind系列

  5. 隐藏 php apache 的版本号

    隐藏Apache版本信息 找到apache安装路径,譬如\Apache\conf\httpd.conf 修改httpd.conf ServerTokens ProductOnly ServerSign ...

  6. JVM——类加载器的双亲委派模型

    类加载器双亲委派模型,如下图所示: 双亲委派模型的工作过程 如果一个类加载器收到了类加载的请求,它首先不会自己去尝试加载这个类,而是把这个请求委派给父类加载器去完成,每一个层次的类加载器都是如此,因此 ...

  7. RAC 环境下修改归档模式

    RAC环境下的归档模式切换与单实例稍有不同,主要是共享存储所产生的差异.在这种情况下,我们可以将RAC数据库切换到非集群状态下,仅仅在一个实例上来实施归档模式切换即可完成RAC数据库的归档模式转换问题 ...

  8. nested push animation can result in corrupted navigation bar

    2013-12-06 10:15:51.668 CodingForFun[4569:70b] nested push animation can result in corrupted navigat ...

  9. ACE的 日志

    http://wenku.baidu.com/link?url=dK6j9_0pICRjxWW7usBlkCxPTa8zFSPyUe_uWAkwMPFDU4ip_tEfxpOitxjkl3RuPy3D ...

  10. How do I list all tables/indices contained in an SQLite database

    How do I list all tables/indices contained in an SQLite database If you are running the sqlite3 comm ...