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. Linux删除文件后磁盘目录不释放

    今天测试oracle数据库的时候,把表空间连带内容和数据文件一并删除了,但是删除之后,查看数据文件不存在了,但是目录的带下没有释放 SQL> drop tablespace users incl ...

  2. JD6621快速充电协议芯片,带有PPS 控制器的USB-PD3.0

    描述 JD6621是高度集成的USB供电(PD)控制器,支持USB PD 3.0 ,该USB PD 3.0 具有针对USBType-C下游接口(源)设计的可编程电源(PPS)规范.它监视CC引脚以检测 ...

  3. MySQL设计之Schema与数据类型优化

    一.数据类型优化 1.更小通常更好 应该尽量使用可以正确存储数据的最小数据类型,更小的数据类型通常更快,因为它们占用更少的磁盘.内存和CPU缓存,并且处理时需要的CPU周期更少,但是要确保没有低估需要 ...

  4. Bitter.Core系列七:Bitter ORM NETCORE ORM 全网最粗暴简单易用高性能的 NETCore ORM 示例 更新删除插入

    Bitter Orm 在操作数据库增删改的时候,支持模型驱动和直接执行裸SQL 操作,示例代码如下: 一:模型驱动(增删改) /// <summary> /// 插入,删除,更新示例(模型 ...

  5. [从源码学设计] Flume 之 memory channel

    [从源码学设计] Flume 之 memory channel 目录 [从源码学设计] Flume 之 memory channel 0x00 摘要 0x01 业务范畴 1.1 用途和特点 1.2 C ...

  6. Docker 中的网络功能介绍 外部访问容器 容器互联 配置 DNS

    Docker 中的网络功能介绍 | Docker 从入门到实践 https://vuepress.mirror.docker-practice.com/network/ Docker 允许通过外部访问 ...

  7. 风险识别系统-大数据智能风控管理平台-企业风控解决方案– 阿里云 https://www.aliyun.com/product/saf

    风险识别系统-大数据智能风控管理平台-企业风控解决方案– 阿里云 https://www.aliyun.com/product/saf

  8. loj10006数列分段

    题目描述 对于给定的一个长度为 N 的正整数数列 A,现要将其分成连续的若干段,并且每段和不超过 M(可以等于 M),问最少能将其分成多少段使得满足要求. 输入格式 第一行包含两个正整数 N,M表示了 ...

  9. Prometheus为你的SpringBoot应用保驾护航

    前面我们介绍了Prometheus的作用和整体的架构,相信大家对Prometheus有了一定的了解. 具体可以查看这篇文章:https://mp.weixin.qq.com/s/QoAs0-AYy8k ...

  10. Language Guide (proto3) | proto3 语言指南(一)定义消息类型

    定义消息类型 首先让我们看一个非常简单的例子.假设您想定义一个搜索请求消息格式,其中每个搜索请求都有一个查询字符串.您感兴趣的特定结果页以及每页的结果数.下面是用于定义.proto消息类型的文件. s ...