HOJ
epk_lee
这个作者很懒,什么都没留下…
展开
-
HOJ 1526 Drink, on Ice
http://acm.hit.edu.cn/hoj/problem/view?id=1526分别计算冰和水的E-T函数利用体系总能量判断状态#include #include const double CW = 4.19, CI = 2.09;const double BW = 397.7, BI = 62.7;conse double EM = 335;int main原创 2012-11-25 00:11:20 · 277 阅读 · 0 评论 -
HOJ 2111 Electrical Outlets
http://acm.hit.edu.cn/hoj/problem/view?id=2111给若干个接线板 问最多能得到几个可用的插孔#include int main(){ int n, k, i, o[11], s, powerout; scanf("%d", &n); while (n--) { s = 0;原创 2012-11-20 22:52:41 · 190 阅读 · 0 评论 -
HOJ 2105 Bungee Jumping
http://acm.hit.edu.cn/hoj/problem/view?id=2105已知绳子劲度系数为k 原长为l 桥高为s某人体重为w重力加速度g=9.81剩下是一个物理问题: ① 原长小于桥高kΔl>2wgs//劲度系数太大在空中下不来v=sqrt(2*g*s-((k*(s-l)*(s-l)/w))); //末速度v>10就挂了② 原长大于等原创 2012-11-20 22:53:22 · 208 阅读 · 0 评论 -
HOJ 2322 Incomplete chess boards
http://acm.hit.edu.cn/hoj/problem/view?id=2322一个国际象棋棋盘挖去两个空问剩下的为止能否被1x2的矩形填满 截一张图格子黑白相间 相邻两个异色格子正好构成1x2的矩形因此只要挖去的这两个格子是一黑一白 就一定能被1x2的矩形填满最后要注意格式#include bool black_white(int x, i原创 2012-11-21 14:41:47 · 277 阅读 · 0 评论 -
HOJ 2785 The Game
http://acm.hit.edu.cn/hoj/problem/view?id=2785有n个碗 每个碗里面有mi个弹子将第i个碗里的一个弹子移出 就在i之前的每一个碗移入一个弹子移动第一个碗时 别的碗不移入弹子 从最后一个碗开始移#include int main(){ int n, i, j; long long step, mi[64];原创 2012-11-21 14:46:37 · 218 阅读 · 0 评论 -
HOJ 2100 Beat the Spread!
http://acm.hit.edu.cn/hoj/problem/view?id=2100给两个非负数s和ds为两数之和 d为两数之差的绝对值求这两个数#includeint main(){ unsigned int n, s, d, big, little; scanf("%u", &n); while (n--) { sc原创 2012-11-21 14:54:58 · 232 阅读 · 0 评论 -
HOJ 2089 4th point
http://acm.hit.edu.cn/hoj/problem/view?id=2089给出平行四边形的三个点 寻找第四个给出的三个点有一个重复找出重复点 利用对角线交点坐标求第四个#include int main(){ int i, j; double x[5], y[5], x4, y4; while (scanf("%lf %lf原创 2012-11-21 15:08:01 · 221 阅读 · 0 评论 -
HOJ 2076 Series Determination
http://acm.hit.edu.cn/hoj/problem/view?id=2076二元一次方程组给出f(0), f(1), f(2) 求 f(3), f(4), f(5)#include int main(){ double f[8], a, b, c; while (scanf("%lf %lf %lf",&f[0],&f[1],&f[2])!=EO原创 2012-11-21 15:08:03 · 183 阅读 · 0 评论 -
HOJ 2201 Sum of Cubes
http://acm.hit.edu.cn/hoj/problem/view?id=2201"For each test case, output two integers x and y such that x^3 + y^3 = n"要考虑负数另外578^3-577^3=1000519无脑打表流数组用int型会失精#include #include int mai原创 2012-11-20 22:52:30 · 340 阅读 · 0 评论 -
HOJ 2412 Triangular Sums
http://acm.hit.edu.cn/hoj/problem/view?id=2412#include int T(int x);int main(){ int n, i, j, num, s; scanf("%d", &n); for (i = 1; i <= n; i++) { s = 0; scanf("%原创 2012-11-20 16:18:53 · 213 阅读 · 0 评论 -
HOJ 2437 Quicksum
http://acm.hit.edu.cn/hoj/problem/view?id=2437#include #include int main(){ int len,i,j,num[512],sum; char str[512]; while(gets(str)!=0) { if(str[0]=='#') brea原创 2012-11-20 16:16:10 · 176 阅读 · 0 评论 -
HOJ 2453 Nasty Hacks
http://acm.hit.edu.cn/hoj/problem/view?id=2453计算收益#include int main(){ int n, r, e, c; scanf("%d", &n); while (n--) { scanf("%d %d %d", &r, &e, &c); if(r ==原创 2012-11-20 16:12:11 · 191 阅读 · 0 评论 -
HOJ 2411 Quick Change
http://acm.hit.edu.cn/hoj/problem/view?id=2411换钱 保证总硬币数最小#include int main(){ int n,c,nQUARTER,nDIME,nNICKEL; int i; scanf("%d", &n); for (i = 1; i <= n; i++) { nQU原创 2012-11-20 16:20:18 · 277 阅读 · 0 评论 -
HOJ 2314 Stamps
http://acm.hit.edu.cn/hoj/problem/view?id=2314最少要几个人能借到所需要的邮票注意格式#include #include int compar(const void *a,const void *b);int main(){ int n; int total, num, sum, offer[1024]= {0};原创 2012-11-20 16:20:58 · 181 阅读 · 0 评论 -
HOJ 2267 Alice and Bob
http://acm.hit.edu.cn/hoj/problem/view?id=2267 Alice从A地出发 Bob从B地出发 相向而行第一次相遇时距离A地m 第二次相遇的时候距离B地n设AB两地距离为s则m/(s-m)=(s+n)/(2s-n) //速度之比相等 s=3m-n#include int main(){ int m, n, s;原创 2012-11-20 16:21:01 · 178 阅读 · 0 评论 -
HOJ 2808 Cylinder
http://acm.hit.edu.cn/hoj/problem/view?id=2808首先w>=2r →r分情况讨论① :以w为高 以h-2r为周长h-2r>=2*pi*r → rr1=min(h/(2*pi+2),w/2)v1=r1^2*pi*w② :以h-2r为高以w为周长w>=2*pi*r → rr2=w/2*piv2=w^2 * (h-原创 2012-11-20 11:52:28 · 198 阅读 · 0 评论 -
HOJ 2782 Alfredo's Pizza Restaurant
http://acm.hit.edu.cn/hoj/problem/view?id=2782计算矩形最小外接圆半径与给定r比较即可#include int main(){ int r, w, l, count; count = 1; while (scanf("%d", &r) && r) { scanf("%d %d", &w,原创 2012-11-20 13:01:48 · 213 阅读 · 0 评论 -
HOJ 2528 1 2 and 3
http://acm.hit.edu.cn/hoj/problem/view?id=2528#includeint main(){ int x, y, z; while (scanf("%d %d", &x, &y) != EOF) { z = 6 - x - y; printf("%d\n", z); }原创 2012-11-20 15:28:17 · 219 阅读 · 0 评论 -
HOJ 2258 Rotating
http://acm.hit.edu.cn/hoj/problem/view?id=2258正n边形外接圆半径R=1沿贴地的那一边滚动m次求最开始在最左下那个顶点的移动轨迹长度 正n边形内角A=2*pi/n易知该正n边形滚动n次之后回到初始状态以正五边形为例五边形如上图滚动4次 每次滚动半径如左图可以计算出一个滚动周期内的顶点走过的距离其余见代码原创 2012-11-21 20:06:13 · 459 阅读 · 0 评论 -
HOJ 2071 Keep on Truckin'
http://acm.hit.edu.cn/hoj/problem/view?id=2071输入三个数 输入CRASH 第一个小于等于168的数若没有 输出NO CRASH#include int main(){ int a, b, c; while (scanf("%d %d %d", &a, &b, &c) != EOF) {原创 2012-11-22 22:42:57 · 191 阅读 · 0 评论 -
HOJ 1863 整数的排序
http://acm.hit.edu.cn/hoj/problem/view?id=1863顺便复习冒泡和选择#include#includeint compar(const void *a, const void *b);void select_sort(int a[], int n);void bubble_sort(int a[], int n);int main()原创 2012-11-23 23:21:33 · 222 阅读 · 0 评论 -
HOJ 1853 WERTYU
http://acm.hit.edu.cn/hoj/problem/view?id=1853输入字符 输出键盘上该字符左边的字符#include char s[48]="`1234567890-=QWERTYUIOP[]\\ASDFGHJKL;'ZXCVBNM,./";void transfrom(char c);int main(){ char str[100];原创 2012-11-23 23:21:36 · 292 阅读 · 0 评论 -
HOJ 1746 Filling Out the Team
http://acm.hit.edu.cn/hoj/problem/view?id=1746计算此人可以胜任的位置#include int main(){ double speed, weight, strength; bool flag; while (scanf("%lf %lf %lf", &speed, &weight, &strength) !=原创 2012-11-23 23:21:39 · 219 阅读 · 0 评论 -
HOJ 1696 No Brainer
http://acm.hit.edu.cn/hoj/problem/view?id=1696#include int main(){ int cases, x, y; scanf("%d", &cases); while (cases--) { scanf("%d %d", &x, &y); if (x < y)原创 2012-11-23 23:21:43 · 250 阅读 · 0 评论 -
HOJ 2519 Fake coin
http://acm.hit.edu.cn/hoj/problem/view?id=2519分成3堆以sample in 20为例①6 6 8若fake在6②2 2 2③1 1若fake在8②3 3 2③1 1 1或1 1#include #include int main(){ int cases, n , m; scanf("%原创 2012-11-25 00:11:05 · 324 阅读 · 0 评论 -
HOJ 1684 Symmetric Order
http://acm.hit.edu.cn/hoj/problem/view?id=1684#include int main(){ char str[16][32]; int n, count = 1; int i, j; while (scanf("%d", &n) && n) { for (i = 1; i <= n; i+原创 2012-11-25 00:11:09 · 237 阅读 · 0 评论 -
HOJ 1637 HangOver
http://acm.hit.edu.cn/hoj/problem/view?id=1637#include #include int fun(double c);int main(){ double c; while (scanf("%lf", &c) && c) { printf("%d card(s)\n", fun(c));原创 2012-11-25 00:11:15 · 184 阅读 · 0 评论 -
HOJ 1610 Twenty Questions
http://acm.hit.edu.cn/hoj/problem/view?id=1610N个物品 每个问题K个答案 问最多问几个问题可以确定某个物品取对数即可#include #include int main(){ double n, k, m; while (scanf("%lf %lf", &k, &n) != EOF) {原创 2012-11-25 00:11:16 · 182 阅读 · 0 评论 -
HOJ 1866 猩猩点灯
http://acm.hit.edu.cn/hoj/problem/view?id=1866找规律 只有序号为i^2 (1#include#includeint main(){ int k; while (scanf("%d" ,&k) && k) printf("%d\n", (int)sqrt(k)); return 0;}原创 2012-11-23 23:21:29 · 644 阅读 · 1 评论 -
HOJ 1951 Beavergnaw
http://acm.hit.edu.cn/hoj/problem/view?id=1951给出树干的直径和被松鼠啃去的体积 计算剩下树干的直径#include #include int main(){ const double pi = acos(-1); int d, v;//D, V double diameter, tmp; whi原创 2012-11-23 13:21:54 · 241 阅读 · 0 评论 -
HOJ 2989 Zhou Yi & HOJ 3015 Zhou Yi II
http://acm.hit.edu.cn/hoj/problem/view?id=2989二进制转换#include #include #include int main(){ int k, i, j, d; int bin[32] = {0}; char str[4]; while (scanf("%d",&k) != EOF)原创 2012-11-19 22:44:56 · 342 阅读 · 0 评论 -
HOJ 2067 Adding 1s, 2s, and 3s
http://acm.hit.edu.cn/hoj/problem/view?id=2067找规律 多写几项从第四项开始f(n)=f(n-1)+f(n-2)+f(n-3)#include #include int f(int n);int main(){ int t, n, count; scanf("%d", &t); while (t--)原创 2012-11-23 13:21:39 · 535 阅读 · 0 评论 -
HOJ 2065 Fibonacci Number
http://acm.hit.edu.cn/hoj/problem/view?id=2065数据量很小 直接打表#include int main(){ int i, j, n, num, a[64]; a[0] = 0, a[1] = a[2] = 1; for (i = 3; i < 50; i++) { a[i] = a[i-1原创 2012-11-23 13:21:43 · 253 阅读 · 0 评论 -
HOJ 2017 Peter's smokes
http://acm.hit.edu.cn/hoj/problem/view?id=2017一个人有n根雪茄 k个烟头可以换一根雪茄他总共可以抽几根#include int main(){ int n, k, remain, sum; while (scanf("%d %d", &n, &k) != EOF) { sum = remain原创 2012-11-23 13:21:44 · 297 阅读 · 0 评论 -
HOJ 2016 Conic Distance
http://acm.hit.edu.cn/hoj/problem/view?id=2016给出两个点的 计算这两点在圆锥面上的最短距离把圆锥展开为扇形 两点间距离利用余弦定理计算注意角度#include #include double min(double a, double b);int main(){ const double pi=acos(-1);原创 2012-11-23 13:21:46 · 278 阅读 · 0 评论 -
HOJ 2012 Sort and Merge
http://acm.hit.edu.cn/hoj/problem/view?id=2012给出n个正整数 拿出两个最小的数字 把这两个数字的和-1放回原先的整数表中 重复操作 直到表中只有一个元素为止骗人的题 不用排序 #include int main(){ int num[10000]; int n, result, sum, i; whi原创 2012-11-23 13:21:48 · 244 阅读 · 0 评论 -
HOJ 1976 Calendar
http://acm.hit.edu.cn/hoj/problem/view?id=19762000-01-01是星期六#include int isrun(int x);int main(){ char week[7][10] = {"Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "原创 2012-11-23 13:21:50 · 216 阅读 · 0 评论 -
HOJ 1962 Above Average
http://acm.hit.edu.cn/hoj/problem/view?id=1962计算平均分上人数占总人数的百分比#include int main(){ int cases, n, a[1000], i, count, sum; double rate, avg; count = sum = 0; scanf("%d", &cases);原创 2012-11-23 13:21:52 · 260 阅读 · 0 评论 -
HOJ 2541 Merry Christmas
http://acm.hit.edu.cn/hoj/problem/view?id=2541注意格式#includeint main(){ int m, n, i, j; while (scanf("%d %d", &m, &n) != EOF) { for (i = 1; i <= m; i++) {原创 2012-11-20 15:28:15 · 189 阅读 · 0 评论 -
HOJ 2588 Mispelling
http://acm.hit.edu.cn/hoj/problem/view?id=2588删去对应位置的字符#include #include int main(){ int i, j, len, m, dig; char word[96]; scanf("%d", &m); for (i = 1; i <= m; i++ ) {原创 2012-11-20 15:28:14 · 256 阅读 · 0 评论