lightoj 1148 Mad Counting(数学水题)】的更多相关文章

lightoj 1148 Mad Counting 链接:http://lightoj.com/volume_showproblem.php?problem=1148 题意:民意调查,每一名公民都有盟友,问最少人数. 思路:考察的知识点有两个:第一是整数相乘取上整:第二是容器大小(ps:不能算一个知识点,只能算一个坑点). 做题思路:排序,如果被调查的人有相同盟友人数(n)的个数(cnt)大于这个数+1,即:(cnt > n+1), 容器已满,只能新开辟一个容器来装盟友. 代码: #includ…
先上题目: 1148 - Mad Counting   PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population of the town. Now the naive approach to…
1148 - Mad Counting   PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population of the town. Now the naive approach to this p…
1148 - Mad Counting   PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population of the town. Now the naive approach to this p…
这道题的题目描述灰常简单,第一眼看以为是一道十分水的题目: 但是!!!(我仔细一看也没有发现这背后隐藏着可怕的真相~) 下面给出题目描述: 给出一个整数x,你可以对x进行两种操作.1.将x变成4x+32.将x变成8x+7问,最少通过多少次操作,使得x是1000000007的倍数? 没错,就是这么坑!当我仔细读完题目后本还抱有几分希望(也许可以水过) 但是!!!没错我又一次用了"但是"这个词: 当我看到数据范围时我几乎就放弃了,只能用暴力来骗分了,仅仅只水到了50分(也知足了) [输入格…
本来是不打算贴这道水题的,自己却WA了三次.. 要考虑1的情况,1的质因子为1 思路:先打表 ,然后根据最大质因子更新结果 代码: #include<iostream> #include<cstdlib> #include<cstdio> #include<cstring> using namespace std; #define MAX 20000 int p[MAX]; int main() { memset(p,,sizeof(p)); p[]=; ;…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=494 题目大意: 一只蜗牛要从爬上n英寸高的地方,他速度为u每分钟,他爬完u需要休息1分钟,且他休息时下滑d英寸,问他什么时候爬出去. 吐槽: 小学的数学题编程了编程题,简直丧心病狂. 思路: 数据量小直接模拟即可. 也可以用数学推导 模拟板: #include<cstdio> int main() { int n,u,d; while(~scanf("%d%d%d…
B - B Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%lld & %llu Submit Status Practice LightOJ 1338 Description In this problem you are given two names, you have to find whether one name is hidden into another. The restrictions are:…
Equations 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1840 ——每天在线,欢迎留言谈论. 题目大意: 给你一个一元二次方程组,a(X^2) + b(X) + c = 0 .求X解的个数. 思路: 分别讨论二次方程与一次方程的情况,再特殊处理下 a = b = c = 0 的情况. 感想: 是时候该水水题了. Java AC代码: import java.math.*; import java.util.Scanner; public…
弹珠游戏 Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 14  Solved: 10 SubmitStatusWeb Board Description ske_fire跟梦梦最近迷上了一款弹珠游戏,游戏开始时双方向对方发射一颗弹珠,双方弹珠都具有不同的速度.在碰撞之后弹珠会原路返回, 因为这款游戏物理引擎比较差,所以弹珠的速度没有改变.并且梦梦跟sky_fire都在原来他们发射的地方竖起了反弹板, 反弹板会将弹珠再次原路返回,速度不变. 在经历…
1841: so easy!麻麻再也不用担心我的数学了! Time Limit: 1 Sec  Memory Limit: 128 MB Submit: 27  Solved: 15 SubmitStatusWeb Board Description 咱们来一发so easy的数学题,这样麻麻再也不用担心我们的数学不及格了. 现在给你一个方程A[i] = (A[i-1]+A[i+1])/2 - c[i](1 <= i <= n);, 然后给你A[0]和A[n+1] 求A[1] = ?. Inp…
http://acm.hdu.edu.cn/showproblem.php?pid=1408 题目: 挂盐水的时候,如果滴起来有规律,先是滴一滴,停一下:然后滴二滴,停一下:再滴三滴,停一下...,现在有一个问题:这瓶盐水一共有VUL毫升,每一滴是D毫升,每一滴的速度是一秒(假设最后一滴不到D毫升,则花费的时间也算一秒),停一下的时间也是一秒这瓶水什么时候能挂完呢? 一开始Output Limit Exceeded 第一次遇到.... 好吧,不知道是什么原因,看了下别人的..人家是double我…
点此看题面 大致题意: 给定自然数\(n\),让你求出方程\(\sqrt{x-\sqrt n}+\sqrt y-\sqrt z=0\)的自然数解\(x,y,z\)的数量以及所有解\(xyz\)之和. 推式子 这道题应该不是很难. 移项可以得到: \[\sqrt{x-\sqrt n}=\sqrt z-\sqrt y\] 两边同时平方: \[x-\sqrt n=y+z-2\sqrt {yz}\] 则我们可以得出第一个结论: 当\(n\)为完全平方数,即\(\sqrt n\)为整数时,有无数组解,直接…
分析:一段区间的整数除法得到的结果肯定是相等的,然后找就行了,每次是循环一段区间,暴力 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algorithm> #include <cstring…
不想说了 #include <cstdio> #include <iostream> #include <ctime> #include <vector> #include <cmath> #include <map> #include <queue> #include <algorithm> #include <cstring> using namespace std; typedef long…
题目大意: yuebai has a long sequence of integers A1,A2,-,AN. He also has such a function: F(x)=∑i=1N(⌊Aix⌋+Aimodx) x is a positive integer, which determined by yuebai. Now he wants to know the minimum value of the function. 求一个x 使F[x]最大 解: 从1枚举到10^6 可知 当…
题意:n个字符串,如果元音就是输出大写,否则输出小写. 析:没啥可说的,只要判断AEIOU就OK了. 代码如下: #include <iostream> #include <cstdio> #include <algorithm> #include <queue> #include <vector> #include <cstring> #include <map> #include <cctype> usin…
ural 2032  Conspiracy Theory and Rebranding 链接:http://acm.timus.ru/problem.aspx?space=1&num=2032 题意:给定一个三角形的三条边 (a, b, c),问是否可放在二维坐标,使得3个顶点都是整数点.若可以,输出任意一组解,否则,输出 -1. 思路:暴力枚举:以 a 为半径做第一象限的 1/4 圆, 以 b 为半径做 一.四 象限的半圆,存储整数点的解,暴力枚举 a 整数点与 b 整数点是否构成长度为 c…
Wet Shark and Odd and Even Time Limit: 2000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum poss…
http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=2456 题目大意: 给出两个数a,b(a<=b<=100000),求在a和b之间有多少个完全平方数(包括a和b) 思路: 打表啊打表. #include<cstdio> #include<cstring> #include<cmath> cons…
http://acm.hdu.edu.cn/showproblem.php?pid=1405 题目大意: 给你一个数,让你分解素因子,输出它的各次幂. 如60 输出:2 2 3 1 5 1 (60=2^2*3^1*5^1) 思路: 先筛选出素数,然后除以每个素数,看看有几个.. 注意格式坑爹,每次幂之后都要有空格.PE了 还有就是是以负数结束输入.我看样例直接以为是-1,WA了... 再次就是HDU晚上作死,一直都是Queuing状态. #include<cstdio> #include<…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=1796 题意: 四个人玩游戏,已知三个人的输赢情况,求第四个人的输赢情况. 思路: 设第一个人赢的次数为x输的次数为y 则 x+a1+a2+a3=y+b1+b2+b3 x+y=a1+b1 所以 x=(2*b1+b2+b3-a2-a3)/2 y=a1+b1-x #include<iostream> #include<cstdio> using namespace…
链接:https://ac.nowcoder.com/acm/contest/303/B 来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述 我们这样定义斐波那契数列,F[1]=1,F[2]=1,当n>2时F[n]=F[n-1]+F[n-2]. 斐波那契数列的前10项为:1,1,2,3,5,8,13,21,34,55. 欧几里得算法求解两个数的最大公约数.我们记gcd(a,b)…
lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋规则,在 m*n 的格子放某一棋子,棋子可以沿着它的8个方位直走,问盘子可以放多少个这样的棋子而使任意两个不发生冲突. 思路:数学水题,找下算出几组,找下规律就出来了.值得注意的是有特判. 代码: #include <iostream> #include <cstdio> #inclu…
LINK 题意:给出1~n数字的排列,求变为递增有序的最小交换次数 思路:水题.数据给的很小怎么搞都可以.由于坐标和数字都是1~n,所以我使用置换群求循环节个数和长度的方法. /** @Date : 2017-07-20 14:45:30 * @FileName: LightOJ 1166 贪心 或 置换群 水题.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github…
1148 - Mad Counting PDF (English) Statistics Forum Time Limit: 0.5 second(s) Memory Limit: 32 MB Mob was hijacked by the mayor of the Town "TruthTown". Mayor wants Mob to count the total population of the town. Now the naive approach to this pro…
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.lightoj.com/volume_showproblem.php?problem=1065 题意:给出递推式f(0) = a, f(1) = b, f(n) = f(n - 1) +f(n - 2) 求f(n) 思路:给出了递推式就是水题. /** @Date : 2016-12-17-15.54 * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://github.com/ * @Version : *…
题目 //行开始看被吓一跳,那么大,没有头绪, //看了解题报告,发现这是一道大大大的水题,,,,,//2009 = 7 * 7 * 41//对2009分解,看它有哪些质因子,它最大的质因子是41,那么对于大于等于41的数,直接输出0就行了. #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; int main() { int n; while(scanf("…
题目连接:http://www.spoj.com/problems/CNTPRIME/ #include <iostream> #include <stdio.h> #include <string.h> #include <algorithm> #define lson rt<<1,L,mid #define rson rt<<1|1,mid+1,R /* 水题 题意:给出n个初始值,给出两种操作 0 x y v:将[x,y]的数改…