[poj 2453] An Easy Problem】的更多相关文章

An Easy Problem   Description As we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form. Given a positive integer I, you task is to find out an integer J, which is the m…
An Easy Problem Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 8371   Accepted: 5009 Description As we known, data stored in the computers is in binary form. The problem we discuss now is about the positive integers and its binary form.…
题目链接:POJ 1152 An Easy Problem! 题意:求一个N进制的数R.保证R能被(N-1)整除时最小的N. 第一反应是暴力.N的大小0到62.发现当中将N进制话成10进制时,数据会溢出. 这里有个整除,即(N-1)取模为0. 样例:a1a2a3表示一个N进制的数R.化成10进制: (a1*N*N+a2*N+a3)%(N-1)==((a1*N*N)%(N-1)+(a2*N)%(N-1)+(a3)%(N-1))%(N-1)==(a1+a2+a3)%(N-1). 这样防止了数据的溢出…
POJ 2826 An Easy Problem?! -- 思路来自kuangbin博客 下面三种情况比较特殊,特别是第三种 G++怎么交都是WA,同样的代码C++A了 #include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <cmath> using namespace std; const double eps = 1e-8;…
An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 7837   Accepted: 1145 Description It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his barn…
An Easy Problem?! Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 12970   Accepted: 1995 Description It's raining outside. Farmer Johnson's bull Ben wants some rain to water his flowers. Ben nails two wooden boards on the wall of his bar…
题意: 在墙上钉两块木板,问能装多少水.即两条线段所夹的中间开口向上的面积(到短板的水平线截止) 解法: 如图: 先看是否相交,不相交肯定不行,然后就要求出P与A,B / C,D中谁形成的向量是指向上方的. 然后求出y值比较小的,建一条水平线,求出与另一条的交点,然后求面积. 要注意的是: 这种情况是不能装水的,要判掉. 还有 交G++会WA, 交C++就可以了, 不知道是POJ的问题还是 G++/C++的问题. 代码: #include <iostream> #include <cst…
受该两块木板以形成槽的效果.Q槽可容纳雨水多,注意雨爆跌,思想是非常easy,分类讨论是有点差. 1.假定两条线段不相交或平行,然后再装0: 2.有一个平行x轴.连衣裙0. 3.若上面覆盖以下的,装0: 4.其他,叉积求面积. 直接上代码: #include <iostream> #include <cmath> #include <stdio.h> using namespace std; const double eps=1e-8; struct point{ do…
Description Have you heard the fact "The base of every normal number system is 10" ? Of course, I am not talking about number systems like Stern Brockot Number System. This problem has nothing to do with this fact but may have some similarity. Y…
题目传送门 题意:两条线段看成两块木板,雨水从上方往下垂直落下,问能接受到的水的体积 分析:恶心的分类讨论题,考虑各种情况,尤其是入口被堵住的情况,我的方法是先判断最高的两个点是否在交点的同一侧,然后看看是否高的点覆盖了低的点,用叉积判断方向,其他的情况见网上的解释.貌似没有什么卡精度的数据.最后膜拜楼教主,难以望其项背... /************************************************ * Author :Running_Time * Created Ti…