E-COM-NET
首页
在线工具
Layui镜像站
SUI文档
联系我们
推荐频道
Java
PHP
C++
C
C#
Python
Ruby
go语言
Scala
Servlet
Vue
MySQL
NoSQL
Redis
CSS
Oracle
SQL Server
DB2
HBase
Http
HTML5
Spring
Ajax
Jquery
JavaScript
Json
XML
NodeJs
mybatis
Hibernate
算法
设计模式
shell
数据结构
大数据
JS
消息中间件
正则表达式
Tomcat
SQL
Nginx
Shiro
Maven
Linux
Uva1225
每日算法3 ——
UVa1225
数数字 Digit Counting , ACM/ICPC Danang 2007
一、Question1.题目描述Trungisboredwithhismathematicshomeworks.Hetakesapieceofchalkandstartswritingasequenceofconsecutiveintegersstartingwith1toN(1usingnamespacestd;stringNumberToString(intx){stringstreamss;
clarkjs
·
2023-01-19 10:20
算法
算法
python
c++
算法竞赛入门经典(第2版)紫书 第三章数组和字符串 习题
题目描述问题分析习题3-2分子量(MolarMass,ACM/ICPCSeoul2007,UVa1586)题目描述问题分析代码习题3-3数数字(DigitCounting,ACM/ICPCDanang2007,
UVa1225
阿怪zz
·
2022-03-18 10:21
算法竞赛入门经典(第2版)紫书
数数字(Digit Counting, ACM/ICPC Danang 2007,
UVa1225
)
1225DigitCountingTrungisboredwithhismathematicshomeworks.Hetakesapieceofchalkandstartswritingasequenceofconsecutiveintegersstartingwith1toN(1intcount[10000][10];intmain(){intT,N;for(inti=0;i#includein
物换星移几度秋
·
2020-09-12 07:55
UVa1225
Digit Counting 数数字 (java版本)
数数字(DigitCounting,ACM/ICPCDanang2007,
UVa1225
)把前n(n<=10000)个整数顺次写在一起:123456789101112…数一数0~9各出现多少次(输出10
youyuge34
·
2020-08-26 16:52
acm入门
习题3-3
UVA1225
Digit Counting(20行AC代码)
紫书刷题进行中,题解系列点这里习题3-3UVA1225DigitCounting(20行AC代码)思路分析给定正整数N,将[1,N]的数字顺序拼接为新字符串s,统计s中0-9出现的次数。哈希表计数即可注意每行最后不允许有多余空格AC代码(C++11,打表)#includeusingnamespacestd;intnum[10]={0};intmain(){intT,n;strings;scanf(
是阿俊呐
·
2020-08-26 13:54
算法竞赛入门经典第二版
算法竞赛入门经典习题3-3数数字(Digit Counting,ACM/IMPC Danang 2007,
UVa1225
)
把前n(n#includeintmain(){intn;scanf("%d",&n);inta[10];memset(a,0,sizeof(a));for(inti=1;i0){intx=j%10;//记录余数a[x]++;j=j/10;}}for(inti=0;i<9;i++){printf("%d",a[i]);}printf("%d",a[9]);return0;}如有错误请联系我改正,谢谢
qq_36780394
·
2020-08-26 13:13
习题3-3 数数字(Digit Counting , ACM/ICPC Danang 2007,
UVa1225
)
把前n(n≤10000)个整数顺次写在一起:123456789101112…数一数0~9各出现多少次(输出10个整数,分别是0,1,…,9出现的次数)。Note:一开始的想法是,先把1~10000全都写入数组,然后遍历一遍,统计0~9出现的次数,这显然很蠢。。。正确的打开方式应该是依次输入1~n,每输入一个数就统计一次,多位数要思考一下如何把各个位区分开来。//ex3-3.c#include#in
BODOA
·
2020-08-26 11:59
算法竞赛入门例题练习题
紫书 习题3-3 数数字(Digit Counting,
UVa1225
)
#include#include#include#include#includeusingnamespacestd;constintMAX=10005;intmain(){intt;intnumber[10];scanf("%d",&t);while(t--){intn;scanf("%d",&n);memset(number,0,sizeof(number));for(inti=1;i
消磨、时光
·
2020-08-26 11:54
刘汝佳算法竞赛入门经典(第二版)Digit Counting(
Uva1225
)--- sprintf()实现
原题:UvaOJ:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=830&page=show_problem&problem=3666VJ:https://vjudge.net/problem/UVA-1225整体思路为将1-N每一次都用sprintf写入到buffer里,然后对其读取,进
ZA139
·
2020-08-17 07:04
数数字
算法入门竞赛习题习题3-3数数字(DigitCounting,ACM/ICPCDanang2007,
UVa1225
)把前n(n≤10000)个整数顺次写在一起:123456789101112…数一数0~
Knock man
·
2020-08-02 15:27
刷题
UVa1225
数数字 习题3-3
3-3「
UVa1225
」数数字:把前n(n#include#definemaxn100000//由于N#include#defineN100000chars[N],temp[10];intcount[10
hhallelujah
·
2020-07-04 14:21
算法竞赛入门经典(第二版)3-3数数字
UVA1225
#include#includeintmain(){intn;scanf("%d",&n);getchar();while(n--){charstr[10000];scanf("%s",str);intlen=strlen(str);intnum=0;for(inti=0;i<10;i++){for(intj=0;j
子枫与我
·
2019-10-18 20:00
CH3-UVA1225
UVA1225
思路思路很简单,因为题目说最大输入N,最多不会超过10000,输入的数据组最多20行.我的思路很简单,就是采取枚举1到N的数,然后算出每个数字分解成各位后统计到对应的0~9中.但是对于查询方
sixleaves
·
2016-11-19 21:31
[刷题]算法竞赛入门经典 3-1/UVa1585 3-2/UVa1586 3-3/
UVa1225
原文链接:http://www.cnblogs.com/xienaoban/p/6798115.html书上具体所有题目:http://pan.baidu.com/s/1hssH0KO(我也是在网上找到的pdf,但不记得是从哪里搜刮到的了,就重新上传了一遍)PS:第一次写博客分享我的代码,不知道我对csdn的使用姿势对不对。想不出来要说些什么哈o(^▽^)o,那就直接开工,先写一篇试试。题目:算法
weixin_30287169
·
2016-07-15 20:00
UVa1225
Digit Counting
本题不难,数组循环,简单打表自己太水,开始忽略了(n-1)和n的关系,n的各个数字出现情况只需要在n-1情况下考虑n就好了https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=3666#include #include #include #definemaxn1
sinat_19628145
·
2016-03-09 08:00
UVa1225
,Digit Counting
#include <cstdio> #include <cstring> int main() { int n; scanf("%d", &n); char s[100]; while(n--) { scanf("%s", s);
·
2015-11-02 15:01
count
UVa1225
Digit Counting
#include <stdio.h>#include <string.h>int main(){ int T, N, i, j; int a[10]; scanf("%d", &T); while (T-
·
2015-06-21 00:00
count
uva1225
Digit Cunting
开始题目没看懂卡了一下看懂题意后就差不多可以水出来算是暴力枚举害怕TLE应该是数据给的很少ac了#include intmain(){ intT; scanf("%d",&T); while(T--){ intN,i,t,a[10]={}; scanf("%d",&N); for(i=1;i #include usingnamespacestd; inta[10001][10]; intma
yexiaohhjk
·
2015-04-04 09:00
枚举
main
scanf
int
for
UVa1225
字符串处理
背景:无。#include #include intmain(void){ intt,str[10]; scanf("%d",&t); while(t--){ intn; memset(str,0,sizeof(str)); scanf("%d",&n); for(inti=1;i<=n;i++){ if(i/1000){str[i/1000]++;str[(i/100)%10]++;str[(i
jibancanyang
·
2015-01-05 12:00
UVa1225
蠢办法。。输出注意不要多输了空格。#define_CRT_SECURE_NO_WARNINGS #include #include intb[10],a[10005]; chars[40000]; intmain(){ intm,n; scanf("%d",&m); while(m--){ scanf("%d",&n); a[0]=1; for(inti=1;i
sinat_17231979
·
2014-07-09 22:00
习题3-3 数数字
UVa1225
1.题目描述:点击打开链接2.解题思路:先构造这样的一个串,再一次查找该串中每个数字的个数即可。3.代码:#include #include #include #definemax40000+10 chars[max]; intmain() { intT; scanf("%d",&T); while(T--) { intn; intfirst=1; scanf("%d",&n); char*p=s
u014800748
·
2014-06-20 17:00
uva
上一页
1
下一页
按字母分类:
A
B
C
D
E
F
G
H
I
J
K
L
M
N
O
P
Q
R
S
T
U
V
W
X
Y
Z
其他