LightOJ 1022 【读题】】的更多相关文章

杭电ACM2076--夹角有多大(题目已修改,注意读题) http://acm.hdu.edu.cn/showproblem.php?pid=2076 思路很简单.直接贴代码.过程分析有点耗时间. // #include <stdio.h> // #include <math.h> // int main() // { // int t; // double h,m,s; // //int h,m,s; // int z; // scanf("%d",&…
[托业][全真题库]TEST01-03-阅读题…
选课时间(题目已修改,注意读题) Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2254    Accepted Submission(s): 1791 Problem Description 又到了选课的时间了,xhd看着选课表发呆,为了想让下一学期好过点,他想知道学n个学分共有多少组合.你来帮帮他吧.(xhd认为一样学分的课没区别)…
Description On the evening of 3 August 1492, Christopher Columbus departed from Palos de la Frontera with a few ships, starting a serious of voyages of finding a new route to India. As you know, just in those voyages, Columbus discovered the America…
搞不懂为什么DFS的写法崩了,然后乱暴力,因为题意不是很懂... 主要还是读题吧(很烦 #include <bits/stdc++.h> using namespace std; typedef long long LL; typedef unsigned long long ULL; typedef pair<int,int>PII; const double eps=1e-5; const double pi=acos(-1.0); //const int mod=1e9+7;…
写这道题题解的目的就是纪念一下半个小时才读懂题...英文一多读一读就溜号... 读题时还时要静下心来... 题目链接: http://codeforces.com/contest/659/problem/B 题意: 给定地区及来自相应地区的人的分数,每个地区选两个分数最高的人 参加区域赛,如果选出的两个人唯一,则输出名字,否则如果还需要进行下一次比赛,输出"?". 分析: 不唯一的情况就是第二个人和第三个人的分数相同嘛...排个序找一下就好了. 代码: #include <bit…
The 2014 ACM-ICPC Asia Mudanjiang Regional Contest 昨晚做了训练赛,然后读题又自闭了QAQ. Average Score ZOJ - 3819 题意: 给你两个班级A.B的人数分别是n.m,告诉你n-1.和m个人的成绩,然后让你确定第n个人的成绩,让n在A班中平均成绩会下降,在B班中,平均成绩会上升. 求第n个人的成绩最小和最大分别是多少. 题解: 数据范围小,直接枚举成绩0~100所有的可能,选出最大最小. Domination ZOJ - 3…
求阴影面积: 犯了两个错误,漏看了两个条件. 第一个wa:题面中PI说要取pi = 2 * acos (0.0) 第二个wa: For example, add 10-9 to your result. 这些在比赛中都是输不起的: 题面一旦大致懂了,要注重细节了,细节也会决定成败 #include<cstdio> #include<math.h> #include<queue> #include<map> #include<string> #in…
lightoj 1010 Knights in Chessboard 链接:http://lightoj.com/volume_showproblem.php?problem=1010 题意:国际象棋规则,在 m*n 的格子放某一棋子,棋子可以沿着它的8个方位直走,问盘子可以放多少个这样的棋子而使任意两个不发生冲突. 思路:数学水题,找下算出几组,找下规律就出来了.值得注意的是有特判. 代码: #include <iostream> #include <cstdio> #inclu…
题目 //找规律,123321123321123321…发现这样排列恰好可以错开 // 其中注意题中数据范围: M是行,N是列,3 <= N < 2×M //则猜测:m,m,m-1,m-1,m-2,m-2,……,2,2,1,1求出前m个数字的和就是答案. //发现案例符合(之前的代码第二天发现案例都跑不对,真不知道我当时眼睛怎么了) #include <iostream> #include<stdio.h> #include<string.h> #inclu…
计算数的和的种类,母函数裸题 #include<stdio.h> #include<string.h> ],c2[],a,b; int main(){ int T; while(scanf("%d",&T)!=EOF){ int n,k; ;q<=T;q++){ scanf("%d%d",&n,&k); int i,j,p; memset(c1,,sizeof(c1)); c1[]=;; ;i<=k;i++…
猜数字 Problem Description A有1数m.B来猜.B每猜一次,A就说"太大"."太小"或"对了" . 问B猜n次能够猜到的最大数.   Input 第1行是整数T,表示有T组数据.以下有T行  每行一个整数n (1 ≤ n ≤ 30)    Output 猜n次能够猜到的最大数   Sample Input 2 1 3   Sample Output 1 7   哎呀妈呀,这题什么意思啊.-----第一感觉 细致理解理解:比方数…
http://acm.scau.edu.cn:8000/uoj/mainMenu.html 18000 Two String 时间限制:1000MS  内存限制:65535K提交次数:0 通过次数:0 题型: 编程题   语言: 不限定 Description Given two string A and B and three kinds of operations as following: (1)Push_back c add a character c at the back of st…
题目: 思路: 题目很有意思 首先 题里说:N<=1000 题里又说 诶呦 woc? 这不自相矛盾嘛 最坏情况也就是个 斐波那契数列 几十个数 暴搜+剪枝不就好了嘛 剪枝:从大往小搜,如果前缀和+当前的和<=当前解 return (这正确性很显然 但是不是很好想到) //By SiriusRen #include <cstdio> using namespace std; int n,k,ans,a[55],sum[55]; void dfs(int rec,int x){ if(…
https://leetcode.com/problems/add-two-numbers/ You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked…
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=4842 要注意题目中两点: 1.在踏入妖怪控制的区域那一刹那,先减行动力,然后才能杀妖怪 2.在妖怪控制区域行动力也会恢复 3.妖怪也许不在自己的控制区域 #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using namespace st…
这道题巨坑啊,样例中以-1结束输入的,所以我就天真的以为测试数据也是以-1结束输入的 其实人家原文中说: Input is terminated by a line containing a negative integer. 是以负数结束输入,囧rz! 我这种英语渣渣,怎么可能注意到这种错误 我还以为是算法的问题,就写了两份代码 //#define LOCAL #include <cstdio> ]; int main(void) { #ifdef LOCAL freopen("1…
直接算即可,特别要注意精度 #include<cstdio> #include<cmath> int main(){ int t, CASE(0); double r; scanf("%d", &t); while(t--){ scanf("%lf", &r); printf("Case %d: %.2lf\n", ++CASE, 1e-9 + 4*r*r-M_PI*r*r); } return 0; }…
Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出这个夹角. 注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的. Input 输入数据的第一行是一个数据T,表示有T组数据. 每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时.分.秒. Out…
http://acm.hdu.edu.cn/showproblem.php?pid=2079 背包 #include <cstdio> #include <cstring> #include <algorithm> #define maxn 3000 using namespace std; int dp[maxn]; int a,b; int t,n,k; int main() { scanf("%d",&t); while(t--) {…
1138 - Trailing Zeroes (III)   PDF (English) Statistics Forum Time Limit: 2 second(s) Memory Limit: 32 MB You task is to find minimal natural number N, so that N! contains exactly Q zeroes on the trail in decimal notation. As you know N! = 1*2*...*N.…
Problem Description 时间过的好快,一个学期就这么的过去了,xhd在傻傻的看着表,出于对数据的渴望,突然他想知道这个表的时针和分针的夹角是多少.现在xhd知道的只有时间,请你帮他算出这个夹角. 注:夹角的范围[0,180],时针和分针的转动是连续而不是离散的. Input 输入数据的第一行是一个数据T,表示有T组数据. 每组数据有三个整数h(0 <= h < 24),m(0 <= m < 60),s(0 <= s < 60)分别表示时.分.秒. Out…
题目链接 :http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5592 Japari Park is a large zoo home to extant species, endangered species, extinct species, cryptids and some legendary creatures. Due to a mysterious substance known as Sandstar, all…
http://acm.timus.ru/problem.aspx?space=1&num=1830 这道题需要理解题目操作的意思, 要更改第i位的状态,第i-1位必须激活为1,0-i-2位必须为0,如果0-i-1位开始时全为0,那么从0位开始进行操作 一.首先考虑对于0-i-1位都是0,需要更改i位的情况,需要 1.更改i-1位,2.按一下打开下一页 对于更改i-1位,需要1.更改i-2位,2.按一下打开下一页,3.更改i-2位 可以得到一个式子,设f[i]为第0-i-1位均为0时,使得状态成为…
Sum of Consecutive Prime Numbers Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19697   Accepted: 10800 Description Some positive integers can be represented by a sum of one or more consecutive prime numbers. How many such representatio…
hdu 1153 magic bitstrings 题目大意 一个质数p,现在让你求一个p-1长度的“01魔法串”.关于这个魔法串是这么定义的:     我们现在把这个串经过一段处理变成一个长宽均为p-1的矩阵,对于第i行的串,是由原来的串按每i位取得的.如果这个矩阵每行的串满足:和原来的串相等或是原来的串按位取反,我们就称这个串是魔法串.(说了一大堆如果还没看懂就去问题底下的Discuss看吧….) 题解 一开始热衷于讨论第一行和最后一行的关系…结果什么也没看出来…后来看了别人的题解,才发现自…
妈蛋wa了两次.. 时尚的定义是length大于1的要破个洞,一定要破个洞.. According to rules of the Berland fashion, a jacket should be fastened by all the buttons except only one #include <bits/stdc++.h> using namespace std; typedef __int64 LL; const int N=1e3+10; int a[N]; int n,s…
题意: 给你n个数,然后让你自己选择X,先选择一些+一次:然后选择一些-一次. 思路: 首先要去判断是不是不需要处理或者处理一次的情况: 其实这样的话,你不可能选x然后最小和最大都加减一次,所以肯定是(min+max)/2; 所以在判断一下: #include <bits/stdc++.h> using namespace std; typedef __int64 LL; const int N=1e5+10; LL a[N]; int n; int main() { LL mi,mx; sc…
http://codeforces.com/contest/734/problem/D 一开始的时候看不懂题目,以为象是中国象棋那样走,然后看不懂样例. 原来是走对角线的,长知识了. 所以我们就知道,王有八个方向,所以每个方向选一个来做代表就行了. 那么选谁呢?可以排序,按照他们离王的距离从小到大排,这样就能选出最近的那个(不用被棋挡住) 然后注意下方向的表达,在王的右上角,还要和王在同一对角线才行~不能简单地判x和y的大小关系 #include <cstdio> #include <c…
代码: #include<cstdio> #include<cstring> using namespace std; int main() { int t; scanf("%d",&t); while(t--) { int n,k; int a[9],b[9]; scanf("%d%d",&n,&k); for(int i=1; i<=k; i++) { scanf("%d%d",&…