title: woj1002-Genesis

date: 2020-03-05

categories: acm

tags: [acm,woj]

输入输出考虑一下。easy

#include <iostream>
#include <string>
#include<cctype>
using namespace std; // 考虑换行.最后 .和字母在一起不考虑。cin空格截断,刚好 int main (){
int first=1,cnt=0;
string s;
while(cin>>s){ //EOF 考虑换行,换行后输出上一组的cnt.first=1表示第一行
if(isdigit(s[0])){
if (first)
{ cout<<s<<" "; first=0;}
else{
cout<<cnt<<endl; cnt=0;cout<<s<<" "; }
}
else if(isalpha(s[0])) cnt++; //s[0] >= 'a' && s[0] <= 'z') || (s[0] >= 'A' && s[0] <= 'Z')
}
cout<<cnt<<endl; //EOF
return 0;
}

title: woj1003-birthofnoah

date: 2020-03-04

categories: acm

tags: [acm,woj,数据结构]

简单题。用到map,pair,typedef,iterater。

好久没做,生疏了好多。

description:略

#include<map>
#include<cstdio>
#include<cstring>
#include<iostream> using namespace std; typedef pair<int,int> info; //ancestor,age
map<string,info> family = {{"Adam",make_pair(1,930)},{"Seth",make_pair(2,912)},
{"Enosh",make_pair(3,905)},{"Kenan",make_pair(4,910)},
{"Mahalalel",make_pair(5,895)},{"Jared",make_pair(6,962)},{"Enoch",make_pair(7,365)},{"Methuselah",make_pair(8,969)},
{"Lamech",make_pair(9,777)},{"Noah",make_pair(10,-1)},{"Shem",make_pair(11,-1)},{"Ham",make_pair(11,-1)},{"Japheth",make_pair(11,-1)}}; /*好像struct更简单。但是查起来麻烦
struct people {
string name[20];
int ancestor;
int old;
}
*/ void initial(){
//复习一下
//info p;
//map<string,info> person;
//p=make_pair(1,930); //p.first,p.second
//person.insert(make_pair("Adam",p)); return;
} int main(){
/*
string line;
while(getline(cin,line,'#'))
{cout <<line;
fflush(stdin);
}
*/
//initial();
//char name1[15],name2[15];
string name1,name2;
map<string,info>::iterator iter1,iter2;
while(cin>>name1>>name2) //cin空格截断.getline可以一行
{
// if(family.count(name1)>0) 必定存在,不判断
iter1=family.find(name1);
iter2=family.find(name2);
if(iter1->second.first==-1||iter2->second.first==-1) //注意map用-> pair用.
cout<<"No enough information"<<endl;
else if(iter1->second.first<iter2->second.first)
cout<<"Yes"<<endl;
else
cout<<"No"<<endl; if(iter1->second.second==-1||iter2->second.second==-1)
printf("No enough information\n");
else if(iter1->second.second>iter2->second.second)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}

title: woj1004-noah's ark

date: 2020-03-05

categories: acm

tags: [acm,woj]

简单题。

注意浮点数的处理,用eps 1e-9.注意除法变乘法 a/b=6__a=6*b

description:略

// meters =100 cm  1 inch= 2.54cm  feet=0.3048 m  cubits 45.72cm
// meters/centimeters/inches/cubits/feet
#include<iostream>
#include <cmath>
const double eps=1e-9; using namespace std; //l==w 则spin。否则, Its length to width ratio of exactly six to one provided excellent stability on the high seas.
// fbs abs 求绝对值 cmath double trans(double l,string unit){
if (unit[2]=='t')
l*=100;
else if(unit[2]=='c')
l*=2.54;
else if(unit[2]=='b')
l*=45.72;
else if(unit[2]=='e')
l*=30.48;
return l;
} int main(){
string l,w,h;
int flag=0;
double ll,ww,hh;
while(cin>>ll){
cin>>l>>ww>>w>>hh>>h;
/*
if(!flag)
flag=1;
else
cout<<endl;
*/
ll=trans(ll,l);
ww=trans(ww,w);
if(fabs(ll-ww)<eps)
cout<<"Spin"<<endl;
else if(fabs(ll-6.0*ww)<eps) // 考虑 /0。之前先判断==0,没考虑全。
cout<<"Excellent"<<endl;
else
cout<<"Neither"<<endl;
cout<<endl; }
return 0;
}

woj1002-Genesis woj1003-birthofnoah woj1004-noah's ark的更多相关文章

  1. 【机器学习Machine Learning】资料大全

    昨天总结了深度学习的资料,今天把机器学习的资料也总结一下(友情提示:有些网站需要"科学上网"^_^) 推荐几本好书: 1.Pattern Recognition and Machi ...

  2. HDU-4057 Rescue the Rabbit(AC自动机+DP)

    Rescue the Rabbit Time Limit: 20000/10000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Othe ...

  3. ZOJ 3545 Rescue the Rabbit(AC自动机+状压DP)(The 2011 ACM-ICPC Asia Dalian Regional Contest)

    Dr. X is a biologist, who likes rabbits very much and can do everything for them. 2012 is coming, an ...

  4. 机器学习(Machine Learning)&深度学习(Deep Learning)资料【转】

    转自:机器学习(Machine Learning)&深度学习(Deep Learning)资料 <Brief History of Machine Learning> 介绍:这是一 ...

  5. hdu 4057 AC自己主动机+状态压缩dp

    http://acm.hdu.edu.cn/showproblem.php?pid=4057 Problem Description Dr. X is a biologist, who likes r ...

  6. hdu 4057--Rescue the Rabbit(AC自动机+状压DP)

    题目链接 Problem Description Dr. X is a biologist, who likes rabbits very much and can do everything for ...

  7. CS100.1x-lab3_text_analysis_and_entity_resolution_student

    这次作业叫Text Analysis and Entity Resolution,比前几次作业难度要大很多.相关ipynb文件见我github. 实体解析在数据清洗和数据整合中是一个很重要,且有难度的 ...

  8. NCE3

    Lesson1  A puma at large Pumas are large, cat-like animals which are found in America. When reports ...

  9. hdu4057 Rescue the Rabbit

    地址:http://acm.hdu.edu.cn/showproblem.php?pid=4057 题目: Rescue the Rabbit Time Limit: 20000/10000 MS ( ...

  10. 国内知名的自然语言处理(NLP)团队

    工业界 腾讯人工智能实验室(Tencent AI Lab) 百度自然语言处理(Baidu NLP):对外提供了百度AI开放平台,王海峰(现任百度副总裁,AI技术平台体系AIG总负责人) 微软亚洲研究院 ...

随机推荐

  1. rename命令和批量重命名

    本文为转载文章,转发自 https://blog.csdn.net/GGxiaobai/article/details/53507454 早期版本的rename是C语言版本,如今新的Ubuntu中采用 ...

  2. oracle rac搭建单实例DG步骤(阅读全篇后再做)

    环境介绍 主库: 主机名 rac01 rac02 实体IP 10.206.132.232 10.206.132.233 私有IP 192.168.56.12 192.168.56.13 虚拟IP 10 ...

  3. 视图V_160M和表T_160M的维护

    今天发现一个视图,通过SM30居然无法维护,这个视图就是V_160M,表为T_160M,是采购相关的系统消息, 不过别着急,有办法维护的,呵呵,看下面: 试一试OMCQ这个事物代码吧! 分享出来,给需 ...

  4. mysql 1449 : The user specified as a definer ('usertest'@'%') does not exist 解决方法 (grant 授予权限)

    从服务器上迁移数据库到本地localhost 执行  函数  时报错, mysql 1449 : The user specified as a definer ('usertest'@'%') do ...

  5. [Usaco2009 Feb]Bullcow 牡牛和牝牛

    原题链接https://www.lydsy.com/JudgeOnline/problem.php?id=3398 容易想到的一种\(dp\)就是:设\(dp[i][j]\)表示前\(i\)头牛里面有 ...

  6. Ubuntu20.04 安装火狐开发者版本(水狐)步骤

    1. 从Mozilla Firefox Developer Edition webpage下载. 2. 将下载的"tar.bz2"文件解压到指定目录, 例如/opt/firefox ...

  7. Python+Selenium+Unittest实现PO模式web自动化框架(1)

    1.什么是PO模式? PO是Page Object的缩写 PO模式是自动化测试项目开发实践的最佳设计模式之一,讲页面定位和业务操作分开,也就是把对象的定位和测试脚本分开,从而提供可维护性. 主要有以下 ...

  8. ubuntu14.04 LEMP(linux+nginx+mysql+php5)构建环境

    Install LEMP (Linux, Nginx, MySQL and PHP) Stack on Ubuntu Linux 14.04 LTS by VIVEK GITE on DECEMBER ...

  9. Infrastructure as Code 行为驱动开发指南 https://www.ibm.com/developerworks/cn/devops/d-bbd-guide-iac/index.html

    Infrastructure as Code 行为驱动开发指南 https://www.ibm.com/developerworks/cn/devops/d-bbd-guide-iac/index.h ...

  10. 在Ubuntu安装Docker

    1.查看Linux内核依赖 kernel version >= 3.8 查看代码: uname -a | awk '{split($3, arr, "-"); print a ...