最近在尝试做acm试题,刚刚是1001题就把我困住了,这是题目: Problem Description In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n.   Input The input will consist of a series of integers n, one integer per line   Output For each case, output SUM(n) in one…
按 被中科大软件学院二年级研究生 HCOONa 骂为“误人子弟”之后(见:<中科大的那位,敢更不要脸点么?> ),继续“误人子弟”. 问题: 题目:(感谢 王爱学志 网友对题目给出的翻译)     排名 题目要求:     程序运行时间要不大于1000ms,程序的内存大小不大于32756k.     向审题系统提交总时间是2843秒,审题系统接受的提交时间是860秒. 题目描述:     Jackson想知道他在班级中的排名.教授已经公布班级中人的     学号和分数的列表.计算Jackson…
Help Johnny(类似杭电3568题) Description Poor Johnny is so busy this term. His tutor threw lots of hard problems to him and demanded him to  accomplish those problems in a month. What a wicked tutor! After cursing his tutor thousands of times,  Johnny real…
杭电2093题,Java版 虽然不难但很麻烦. import java.util.ArrayList; import java.util.Collections; import java.util.List; import java.util.Scanner; /** * @Author Yun * @Date 2020/9/9 8:56 * * Accepted!!!!! */ class node implements Comparable<node>{ String name; int…
对于这项曾经热爱的竞赛,不得不说这是我最后一年参加ACM比赛了,所以要珍惜每一次比赛的机会. 五一去杭电参加了赛码"BestCoder"杯中国大学生程序设计冠军赛,去的队伍包括了今年19支World final的队伍,几乎是全国最强的46所学校各出了一个代表队,十分感谢学校给了我这个大三的老年血手这次去比赛的机会. 比赛在5.2一天内完成,上午的热身赛居然是上一场Bestcoder的原题= =.虽然我们三个人都没做过...不过我还是水水的写了前两道题. 在中午的悲惨淋雨后,下午正赛开始…
Robberies 点击打开链接 背包;第一次做的时候把概率当做背包(放大100000倍化为整数):在此范围内最多能抢多少钱  最脑残的是把总的概率以为是抢N家银行的概率之和- 把状态转移方程写成了f[j]=max{f[j],f[j-q[i].v]+q[i].money}(f[j]表示在概率j之下能抢的大洋);  正确的方程是:f[j]=max(f[j],f[j-q[i].money]*q[i].v)  当中,f[j]表示抢j块大洋的最大的逃脱概率,条件是f[j-q[i].money]可达,也就…
数据测试了好几个都没问题,可以就是WA不让过,检测了2个小时还是没发现有什么问题T_T!!求高手看看代码,小弟在此谢谢各位哦! #include <stdio.h> #include <stdlib.h> #define max 1000 /* run this program using the console pauser or add your own getch, system("pause") or input loop */ int main(int…
#include<iostream> #include<cstring> using namespace std; #define INF 0x3f3f3f3f int n,m; ][]; ]; ]; int dijk(){ memset(vis,,sizeof(vis)); vis[]=; //标记第一个已选 memset(stemp,,sizeof(stemp)); int min; ,countx=,county,index2; while(county!=n){//如果是联…
最近想学DP,锻炼思维,记录一下自己踩到的坑,来写一波详细的结题报告,持续更新. 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1003 Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the…
题很简单,一开始写代码,是用整数的格式写的,怎么跑都不对,就以为算法错了,去看大佬们的算法STL全排列:next_permutation(); 又双叒叕写了好几遍,PE了将近次,直到跑了大佬代码发现,原来格式是这样的. 下面是实现全排列的两段代码,睡觉睡觉. STL电动 #include<iostream> #include<cstdio> #include<cstring> #include<map> #include<set> #includ…