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. C# datagridview设置标题为汉语

    正常情况下,在给datagridview绑定数据源之后,显示的是SQL语句中的栏位,如下 我们想让标题显示汉语,可以有一下两种方法 1.在SQL中设置列别名 SELECT TITLE AS '报警标题 ...

  2. Centos 7 关机和重启 命令

    1,关机命令 1 shutdown -h now/0 2 halt 3 init 0 4 poweroff 5 举例: 6 shutdown -h 3 ------3分钟后关机(可用shutdown ...

  3. Slack 的想法很好啊,很有创新,牛。

    [原]https://www.leiphone.com/news/201411/aXHUpe4ZFI2sSwpb.html 由于以往一些用于办公的应用反响平平,因此对迅速崛起的办公交流应用Slack, ...

  4. C# 实现语音聊天

    一.语音聊天说专业点就是即时语音,是一种基于网络的快速传递语音信息的技术,普遍应用于各类社交软件中,优势主要有以下几点: (1)时效性:视频直播会因为带宽问题有时出现延迟高的问题,而语音直播相对来说会 ...

  5. MVC与三层架构解析学习

    概要 MVC与三层架构不是简单的相等,二者之间存在一些区别. 今天,看到一位博主总结笔记,借鉴而来,以供以后学习. 将javaweb开发中的MVC(SSM框架)与三级架构比较,来解析二者之间的关系. ...

  6. 项目管理/Bug管理/问题管理—Phabricator

    项目管理/Bug管理/问题管理-Phabricator 1.项目管理/Bug管理/问题管理工具 2.Phabricator 3.Docker 方式安装Phabricator 3.1Docker方式安装 ...

  7. Spark DataSource Option 参数

    Spark DataSource Option 参数 1.parquet 2.orc 3.csv 4.text 5.jdbc 6.libsvm 7.image 8.json 9.xml 9.1读选项 ...

  8. spark整合Phoenix相关案例

    spark 读取Phoenix hbase table表到 DataFrame的方式 Demo1: 方式一:spark read读取各数据库的通用方式 方式二:spark.load 方式三:phoen ...

  9. log4cplus安装测试

     先介绍一下它的基本要素. Layouts :布局器,控制输出消息的格式. Appenders :挂接器,与布局器紧密配合,将特定格式的消息输出到所挂接的设备终端 (如屏幕,文件等等). Logge ...

  10. 当前日期减去TIMESTAMP(6)日期

    select trunc(sysdate- to_date(to_char(j.create_date,'yyyy-mm-dd'),'yyyy-mm-dd')) 相差天数 from sys_user ...