SGU 186】的更多相关文章

186. The Chain time limit per test: 0.25 sec. memory limit per test: 4096 KB input: standard input output: standard output Smith has N chains. Each chain is the sequence of successively connected links. The length of each chain is known: the first ch…
总是拆最短的链子  连接长的链子   贪心.... #include <cstdio> #include <cstring> #include <cmath> #include <algorithm> using namespace std; int a[110]; int main() { int n; scanf("%d",&n); for(int i = 0; i < n; i++) scanf("%d&qu…
看懂题就是水题... code #include <iostream> #include <algorithm> using namespace std; int a[110], n, l, r, ans; int main() { cin >> n; for (int i = 0; i < n; i++) cin >> a[i]; r = n - 1; sort (a, a + n); while (l < r) { a[l]--, r--;…
#include<bits/stdc++.h> #define de(x) cout<<#x<<"="<<x<<endl; #define dd(x) cout<<#x<<"="<<x<<" "; #define rep(i,a,b) for(int i=a;i<(b);++i) #define repd(i,a,b) for(int…
http://acm.sgu.ru/problemset.php?contest=0&volume=1 101 Domino 欧拉路 102 Coprime 枚举/数学方法 103 Traffic Lights 最短路 104 Little Shop of Flowers 动态规划 105 Div 3 找规律 106 The Equation 扩展欧几里德 107 987654321 Problem 找规律 108 Self-numbers II 枚举+筛法递推 109 Magic of Dav…
水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kilobytes input: standardoutput: standard ICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the…
sgu 101 - Domino Time Limit:250MS     Memory Limit:4096KB     64bit IO Format:%I64d & %I64u Description Dominoes – game played with small, rectangular blocks of wood or other material, each identified by a number of dots, or pips, on its face. The bl…
http://acm.sgu.ru/problem.php?contest=0&problem=495 题意:N个箱子M个人,初始N个箱子都有一个礼物,M个人依次等概率取一个箱子,如果有礼物则拿出礼物放回盒子,如果没有礼物则不操作.问M个人拿出礼物个数的期望.(N,M<=100000) #include <cstdio> using namespace std; double mpow(double a, int n) { double r=1; while(n) { if(n&…
题目链接:http://acm.sgu.ru/problem.php?contest=0&problem=455 Due to the slow 'mod' and 'div' operations with int64 type, all Delphi solutions for the problem 455 (Sequence analysis) run much slower than the same code written in C++ or Java. We do not gua…
题目大意 某人在打字机上打一个字符串,给出了他打每个字符出错的概率 q[i]. 打一个字符需要单位1的时间,删除一个字符也需要单位1的时间.在任意时刻,他可以花 t 的时间检查整个打出来的字符串,并且从当前光标删除到第一个出错的位置(留下的字符串要么为空,要么每个字符都是对的).问你,他正确的打完该字符串最少需要花费的时间的期望值是多少 字符串的长度小于等于3000 题意有点绕,具体可以看看原题是怎么描述的 做法分析 首先确定这是一个概率DP的问题. 定义状态 f[i] 表示正确的打完前 i 个…