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, ...
随机推荐
- linux系统之间基于密钥对免输入密码登陆
通常,我们登陆到一台linux主机是需要输入密码,这样可以验证登陆者的身份. 这篇随笔里面我打算记录一下配置基于ssh密钥对登陆系统.在配置之前先和大家说明一下我遇到过的问题:刚接触到linux时候首 ...
- EasyDSS+EasyNVR实现幼儿园直播/工地直播等分权限观看直播视频的功能
在EasyNVR互联网直播服务器使用说明书中有关于EasyNVR分组的介绍: "EasyNVR的功能定位就是为视频应用层输出视频设备接入/标准视频输出的能力平台层,只做基础的视频通道接入.视 ...
- 九度OJ 1189:还是约瑟夫环 (约瑟夫环)
时间限制:1 秒 内存限制:32 兆 特殊判题:否 提交:820 解决:522 题目描述: 生成一个长度为21的数组,依次存入1到21: 建立一个长度为21的单向链表,将上述数组中的数字依次存入链表每 ...
- 让intellij挂在异常处,特别是出现null pointer的地方
1 在Intellij中设置java exception breakpoint 在调试模式下,run->view breakpoints 在java exception breakpoints- ...
- ACM-最小生成树之继续畅通project——hdu1879
版权声明:本文为博主原创文章,未经博主同意不得转载. https://blog.csdn.net/lx417147512/article/details/27092583 ************** ...
- Oracle视图传递参数
在Oracle里,视图不像存储过程和函数一样,可以定义输入参数,但我们可以变个方式,使用程序包来实现. oracle package: oracle package是oracle包,是一组相关过程.函 ...
- Bootstrap学习4--Table样式(转载:https://blog.csdn.net/Fanbin168/article/details/53208869)
备注:最新Bootstrap手册:http://www.jqhtml.com/bootstraps-syntaxhigh/index.html 将<table>标签添加class=‘tab ...
- R语言set.seed()函数介绍
set.seed(),该命令的作用是设定生成随机数的种子,种子是为了让结果具有重复性.如果不设定种子,生成的随机数无法重现.这个函数的主要目的,是让你的模拟能够可重复出现,因为很多时候我们需要取随机数 ...
- 有关numpy.random下的API具体含义
1.numpy.random.random(size=None) Return random floats in the half-open interval [0.0, 1.0). 返回size大小 ...
- 【leetcode刷题笔记】Distinct Subsequences
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence ...