UVA 494 Kindergarten Counting Game map】的更多相关文章

Everybody sit down in a circle. Ok. Listen to me carefully.“Woooooo, you scwewy wabbit!”Now, could someone tell me how many words I just said?InputInput to your program will consist of a series of lines, each line containing multiple words (at least…
题目大意:输入一个字字符串,输出该字符串中所包含的"word"个数,其中"word"是指连续的字母(大小写均可) 题目思路:其实这是道水题,不过我考虑的时候,太想当然了,我是把空格作为每个子串的分界,遇到一个空格就去判断空格前的子串是否为单词. 然而实际上并不是这样,如果是连续的符号中夹杂着单词的话,就不好判断. 正确思路:对每个输入的字符进行判断,每当遇到非字母的字符时,进行单词判断. (有两点注意:1.输入为回车时,应输出结果并且初始化.2.输入为EOF(-1)…
 Kindergarten Counting Game  Everybody sit down in a circle. Ok. Listen to me carefully. ``Woooooo, you scwewy wabbit!'' Now, could someone tell me how many words I just said? Input and Output Input to your program will consist of a series of lines,…
// uva 11401 Triangle Counting // // 题目大意: // // 求n范围内,任意选三个不同的数,能组成三角形的个数 // // 解题方法: // // 我们设三角巷的最长的长度是c(x),另外两边为y,z // 则由z + y > x得, x - y < z < x 当y = 1时,无解 // 当y = 2时,一个解,这样到y = x - 1 时 有 x - 2个 // 解,所以一共是0,1,2,3....x - 2,一共(x - 2) * (x - 1…
UVa 1225 题目大意:把前n(n<=10000)个整数顺次写在一起,12345678910111213...,数一数0-9各出现多少字 解题思路:用一个cnt数组记录0-9这10个数字出现的次数,先将cnt初始化为0,接着让i从1枚举到n, 对每个i,处理以活的i的每一个位置上的数,并在相应的cnt下标上+1 最后输出cnt数组即可 /* UVa 1225 Digit Counting --- 水题 */ #include <cstdio> #include <cstring…
欢迎访问我的新博客:http://www.milkcu.com/blog/ 原文地址:http://www.milkcu.com/blog/archives/uva494.html 题目描述  Kindergarten Counting Game  Everybody sit down in a circle. Ok. Listen to me carefully. ``Woooooo, you scwewy wabbit!'' Now, could someone tell me how ma…
/** 题目:UVA 1640 The Counting Problem UVA1640 链接:https://vjudge.net/problem/UVA-1640 题意:求[a,b]或者[b,a]区间内0~9在里面各个数的数位上出现的总次数. 思路:数位dp: dp[leadzero][i][j][k]表示前面是否选过非0数,即i长度之后可以第一个出现0,而不是前导0,长度为i,前面出现j,k次,j出现的次数. */ #include<iostream> #include<cstri…
Triangle Counting Time limit1000 ms Description You are given n rods of length 1, 2-, n. You have to pick any 3 of them and build a triangle. How many distinct triangles can you make? Note that, two triangles will be considered different if they have…
题意:给定两个数m, n,求从 m 到 n 中0-9数字各出现了多少次. 析:看起来挺简单的,其实并不好做,因为有容易想乱了.主要思路应该是这样的,分区间计数,先从个位进行计,一步一步的计算过来.都从0开始,最后用大数减小数的即可. 举个例子吧,容易理解.比如0-1234. 先计算个位数字,有1-4,然后计算123各出现了5次,注意是这里是5次,不是4次,因为我们要加上那个0,然后就剩下那个1230了,我们想那么现在个位数从开始到这, 重复了123次,然后再进行下一位,依次进行,直到0. 代码如…
Ducci Sequence Description   A Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, ... , an), the next n-tuple in the sequence is formed by taking the absolute differences of neighboring integers: ( a1, a2, ...…