hdu-5867 Water problem(水题)
题目链接:
Water problem
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 23 Accepted Submission(s): 14
Do not count spaces or hyphens. For example, 342 (three hundred and forty-two) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.
For each test case: There is one positive integer not greater one thousand.
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
#include <bits/stdc++.h>
#include <stack>
#include <map> using namespace std; #define For(i,j,n) for(int i=j;i<=n;i++)
#define mst(ss,b) memset(ss,b,sizeof(ss)); typedef long long LL; template<class T> void read(T&num) {
char CH; bool F=false;
for(CH=getchar();CH<'0'||CH>'9';F= CH=='-',CH=getchar());
for(num=0;CH>='0'&&CH<='9';num=num*10+CH-'0',CH=getchar());
F && (num=-num);
}
int stk[70], tp;
template<class T> inline void print(T p) {
if(!p) { puts("0"); return; }
while(p) stk[++ tp] = p%10, p/=10;
while(tp) putchar(stk[tp--] + '0');
putchar('\n');
} const LL mod=1e9+7;
const double PI=acos(-1.0);
const int inf=1e9;
const int N=5e5+10;
const int maxn=(1<<20)+14;
const double eps=1e-12; int dp[1100]; int check(int x)
{
if(x<=10)
{
if(x==1||x==2||x==6||x==10)return 3;
else if(x==3||x==7||x==8)return 5;
else if(x==4||x==5||x==9)return 4;
}
else if(x<=20)
{
if(x==11||x==12||x==20)return 6;
if(x==13||x==14||x==18||x==19)return 8;
if(x==15||x==16)return 7;
if(x==17)return 9;
}
else if(x<100)
{
if(x%10==0)
{
if(x==30||x==80||x==90)return 6;
else if(x==40||x==50||x==60)return 5;
else if(x==70)return 7;
}
else return check(x%10)+check(x-x%10);
}
else if(x<1000)
{
if(x%100==0)return check(x/100)+7;
else return check(x/100)+10+check(x-(x/100)*100);
}
else return 11;
}
inline void Init()
{
for(int i=1;i<=1000;i++)
{
dp[i]=dp[i-1]+check(i);
}
} int main()
{
int t;
Init();
read(t);
while(t--)
{
int n;
read(n);
print(dp[n]);
}
return 0;
}
hdu-5867 Water problem(水题)的更多相关文章
- HDU 5832 A water problem 水题
A water problem 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5832 Description Two planets named H ...
- HDU 5867 Water problem (模拟)
Water problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5867 Description If the numbers ...
- HDU 5867 Water problem ——(模拟,水题)
我发这题只是想说明:有时候确实需要用水题来找找自信的~ 代码如下: #include <stdio.h> #include <algorithm> #include <s ...
- HDU 5867 Water problem
处理出1-99的,之后的加上多少hundred和and即可.整百和一千的时候注意一下. #pragma comment(linker, "/STACK:1024000000,10240000 ...
- hdu 1106:排序(水题,字符串处理 + 排序)
排序 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submissi ...
- HDU 4950 Monster (水题)
Monster 题目链接: http://acm.hust.edu.cn/vjudge/contest/123554#problem/I Description Teacher Mai has a k ...
- HDU 4813 Hard Code 水题
Hard Code Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- HDU 4593 H - Robot 水题
H - RobotTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.act ...
- HDOJ/HDU 2560 Buildings(嗯~水题)
Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...
随机推荐
- cnn 实例
http://www.geekcome.com/content-10-3761-1.html http://www.geekcome.com/content-10-3761-1.html http:/ ...
- LR测试HTTPS
从浏览器里导出cer证书 保存好后, 下载openssl-1.0.1s安装好openssl之后,进入openssl目录: 输入openssl命令,即进入命令模式: 先将要转换的cer证书也放到open ...
- KPI、KPA、OKR三者的区别
KPI.KPA或者OKR并不是水火不相容有你无我的概念,针对不对的业务状态.管理模式应该有所选择.以下是介绍它们之间的区别. 什么是KPI关键绩效指标 KPI(key performance indi ...
- F - 数论
F - 数论 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Description ...
- iOS开发之获取系统相册ALAssetLibrary
注:当你选择看这篇博客时想必你的应用还支持iOS8一下系统,如果你的应用要求最低版本大于iOS8,建议使用PhotoKit框架,效率更高 ALAssetsLibrary包含,ALAssetsLibra ...
- 如何用excel urldecode解码把url编码转为汉字?
统计分析可以反映出网站运营的情况,并根据实际作出相应的调整,是站长必需的基础技能.ytkah感觉最好用的是谷歌统计,里面有个搜索关键词及对应受访页面,这个功能对优化用处很大,但大家都知道访问不太顺畅. ...
- Linux vim 中文显示乱码解决方法
因为在windows下默认是gb编码,而我的vim默认是utf-8(gedit默认也是utf-8),所以打开会成乱码.改动了一下配置文件,使vi支持gb编码就好了.$vi ~/.vimrclet &a ...
- Python:笔记(3)——面向对象编程
Python:笔记(3)——面向对象编程 类和面向对象编程 1.类的创建 说明:和Java不同的是,我们不需要显示的说明类的字段属性,并且可以在后面动态的添加. 2.构造函数 构造函数的功能毋庸置疑, ...
- 用 Java 技术创建 RESTful Web 服务
JAX-RS:一种更为简单.可移植性更好的替代方式 JAX-RS (JSR-311) 是一种 Java™ API,可使 Java Restful 服务的开发变得迅速而轻松.这个 API 提供了一种基于 ...
- vim编辑器常规配置
为了很舒服的编写程序,请把vim配置好 # apt install vim 安装vim编辑器 #sudo vim /etc/vim/vimrc ///必须加上权限sudo 在这个文件中,会有 ...