http://acm.hdu.edu.cn/showproblem.php?pid=2986

题意很简单,主要是要处理精度,最手残的是把单词拼写错了。。。

 #include <stdio.h>
#include <string.h>
#include <algorithm>
#include <stdlib.h>
#include <iostream>
#include <map>
using namespace std;
const double eps=1e-;
int main()
{
int n,m;
while(~scanf("%d%d",&n,&m)){
map<string,double>p;
p.clear();
string str;
double x;
for (int i = ; i <= n; i++){
cin>>str;
cin>>x;
int tt = int(x*+eps);
p[str] = tt;
}
int o = ;
while(m--){
o++;
int ans = ;
while(){
cin>>str;
if(str==">"||str=="<"||str==">="||str=="<="||str=="=")
break;
ans+=p[str];
}
int k;
cin>>k;
k *=;
int flag1 = ,flag2 = ,flag3 = ,flag4 = ,flag5 = ;
if(str==">"){
if(ans>k)
flag1 = ;
}
else if (str=="<"){
if (ans<k)
flag2 = ;
}
else if (str==">="){
if (ans>=k)
flag3 = ;
}
else if (str=="<="){
if (ans<=k)
flag4 = ;
}
else if (str=="="){
if (ans==k)
flag5 = ;
}
if(flag1||flag2||flag3||flag4||flag5)
printf("Guess #%d was correct.\n",o);
else
printf("Guess #%d was incorrect.\n",o);
}
}
return ;
}

Ballot evaluation的更多相关文章

  1. hdu 2986 Ballot evaluation (模拟)

    题目 上次比赛的题目,好长时间了. 这几天感冒了很难受, 直到现在才整理, 上次比赛的时候,出了各种错误,   ,,,样例都没过,题目读的也很差,今天做的时候, 看了一下网上的,发现一个代码特别简洁, ...

  2. HDU 2986 Ballot evaluation(精度问题)

    点我看题目 题意 : 给你n个人名,每个名后边跟着一个数,然后m个式子,判断是否正确. 思路 :算是一个模拟吧,但是要注意浮点数容易丢失精度,所以要好好处理精度,不知道多少人死在精度上,不过我实在是不 ...

  3. hdu 2986 Ballot evaluation (Simulation)

    Problem - 2986 之前在华工赛见过的一道简单的模拟,用map轻松干掉.为了精确,要全程用整型比较.轻松1y~ 代码如下: #include <cstdio> #include ...

  4. Utility2:Appropriate Evaluation Policy

    UCP收集所有Managed Instance的数据的机制,是通过启用各个Managed Instances上的Collection Set:Utility information(位于Managem ...

  5. SQL SERVER 2012 从Enterprise Evaluation Edtion 升级到 Standard Edtion SP1

    案例背景:公司从意大利购买了一套中控系统,前期我也没有参与其中(包括安装.实施都是第三方),直到最近项目负责人告诉我:前期谈判以为是数据库的License费用包含在合同中,现在经过确认SQL Serv ...

  6. Evaluation Clustering methods

    There are many evaluation measures available like entropy, recall, precision, F-measure, silhouette ...

  7. PLT:说说Evaluation strategy

    Brief 在学习方法/函数时,我们总会接触到 按值传值 和 引用传值 两个概念.像C#是按值传值,但参数列表添加了ref/out后则是引用传值,但奇怪的事出现了 namespace Foo{ cla ...

  8. PyMySQL Evaluation

    PyMySQL Evaluation This page will capture issues related to Openstack moving to the PyMySQL driver f ...

  9. 分配给 主机的 Evaluation Mode 许可证已过期。建议升级许可证。

    参考文献 http://247its.wordpress.com/2012/04/02/new-build-esxi-5-complaints-licence-has-expired/ http:// ...

随机推荐

  1. 最大子段和(洛谷P1115,动态规划递推)

    洛谷题目链接 题目赋值出来格式有问题,所以我就只放题目链接了 下面为ac代码 #include<bits/stdc++.h> #define ll long long using name ...

  2. SQL Server 机考,用T-SQL编写 简单实例

    使用T-SQL实现以下要求: 要求如下: 1,添加数据库:MySchool 2,添加学生基础表:Student 3,添加学生成绩表:ScoreInfo 4,两张表结构分别如下 Student表结构:( ...

  3. Keil uVision “已停止工作”

    之前一直受这个问题的困扰,但是因为只是下载程序,下载镜像文件完事就算了.随便keil挂掉. 今天要调试程序,发现开启调试keil就挂掉了,烦. 解决办法参见: http://218.244.144.1 ...

  4. 解决ASP.NET Core部署到IIS,更新项目"另一个程序正在使用此文件,进程无法访问"

    问题:部署到IIS上的ASP.NET Core项目,在更新的时候会进程占用的错误 初步解决方案: 1,关闭应用程序池 2,关闭网站 3,更新项目 缺点:网站没法访问,部署项目停的时间过长 查询官方文档 ...

  5. Spring security 5 Authorize Configuration

    1. Spring Security 核心请求,认证配置类 WebSecurityConfigurerAdapter protected void configure(HttpSecurity htt ...

  6. VM 与 与 Linux 的安装

    [VMWare  安装] 输入后, [CentOS ] 1  检查 BIOS  虚拟化 2.新建虚拟机 3.新建虚拟机向导 4创建虚拟空盘 5  安装 Linux  系统对应的 CentOS 6  虚 ...

  7. codevs3411 洪水

    题目描述 Description 小浣熊松松和朋友到野外露营,没想到遇上了π年一次的大洪水,好在松松是一只爱观察的小浣熊,他发现露营地的地形和洪水有如下性质: ①露营地可以被看做是一个N*M的矩形方阵 ...

  8. HashMap源码分析2:扩容

    本文源码基于JDK1.8.0_45. final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; int oldCap = ...

  9. SIGSEGV 和 SIGBUS & gdb看汇编

    参考这篇文章: http://blog.chinaunix.net/uid-24599332-id-2122898.html SIGBUS和SIGSEGV也许是我们在平时遇到的次数最多的两个内存错误信 ...

  10. [Vue @Component] Dynamic Vue.js Components with the component element

    You can dynamically switch between components in a template by using the reserved <component>  ...