HDU 5867 Water problem (2016 多校训练#10 1011)
来源:互联网 发布:软件购销合同书范本 编辑:程序博客网 时间:2024/06/09 20:16
题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=5867View Code
题意:给一个不超过一千的数字N,求出1-N所有单词加起来的字母个数和(f(1)=len(one)=3,f(2)=f(1)+len(two)=6...)。
分析:一看名字就知道是到水题了...直接打表。(保险起见,我还手打了20内的表)。
代码:
#include<cstdio>#include<cmath>#include<cstring>#include<queue>#include<stack>#include<cstdlib>#include<iomanip>#include<string>#include<vector>#include<map>#include<string>#include<iostream>#include<algorithm>using namespace std;#define INF 0x3f3f3f3ftypedef long long ll;#define Max(a,b) (a>b)?a:b#define lowbit(x) x&(-x)int main(){ int a[1005]={0}; a[1]=3; a[2]=3; a[3]=5; a[4]=4; a[5]=4; a[6]=3; a[7]=5; a[8]=5; a[9]=4; a[10]=3; a[11]=6; a[12]=6; a[13]=8; a[14]=8; a[15]=7; a[16]=7; a[17]=9; a[18]=8; a[19]=8; a[20]=6; a[30]=6; a[40]=5; a[50]=5; a[60]=5; a[70]=7; a[80]=6; a[90]=6; a[100]=3+7; for(int i=20;i<100;i+=10) { for(int j=i+1;j<i+10;j++) a[j]=a[i]+a[j-i]; } for(int i=100;i<1000;i+=100) { a[i]=a[i/100]+7; for(int j=i+1;j<=i+99;j++) { a[j]=a[i]+3+a[j-i]; } } a[1000]=3+8; for(int i=2;i<=1000;i++) a[i]+=a[i-1]; int t; scanf("%d",&t); while(t--) { int n; scanf("%d",&n); printf("%d\n",a[n]); }}
0 0
- HDU 5867 Water problem (2016 多校训练#10 1011)
- 2016多校训练Contest10: 1011 Water problem hdu5867
- #2016多校训练Contest10: 1011 Water problem hdu5867
- HDU 5858 Hard problem (2016 多校训练#10 1002)
- 2017多校训练-A Water Problem-DP
- HDU-2017 多校训练赛10-1011-Two Paths
- 2016多校训练Contest4: 1009 String problem hdu5772
- 2016多校训练Contest10: 1002 Hard problem hdu5858
- #2016多校训练Contest10: 1002 Hard problem hdu5858
- 2016多校训练Contest6: 1011 Zhu’s Math Problem hdu5803
- HDU-2017 多校训练赛2-1011-Regular polygon
- HDU-2017 多校训练赛6-1011-Classes
- HDU-2017 多校训练赛7-1011-Kolakoski
- HDU-2017 多校训练赛8-1011-Killer Names
- HDU-2017 多校训练赛10-1010-Schedule
- HDU-2017 多校训练赛10-1008-Monkeys
- HDU-2017 多校训练赛10-1002-Array Challenge
- HDU-2017 多校训练赛10-1001-Admiral
- jmeter通过jmeter-plugins、jconsole对系统资源进行监控
- poj 2371 Questions and answers
- poj 2372 D++ Again
- HDU 5857 Median (2016 多校训#10 1001)
- HDU 5858 Hard problem (2016 多校训练#10 1002)
- HDU 5867 Water problem (2016 多校训练#10 1011)
- CodeForces 13A Numbers
- CodeForces 14A Letter
- CodeForces 14C Four Segments
- HDU 1270 小希的数表
- POJ 1845 Sumdiv
- POJ 2128 Highways
- CodeForces 15A Cottage Village
- bzoj 2534: Uva10829L-gap字符串 后缀数组+线段树合并