题意:给定一个浮点数,让你在时间 t 内,变成一个最大的数,操作只有把某个小数位进行四舍五入,每秒可进行一次. 析:贪心策略就是从小数点开始找第一个大于等于5的,然后进行四舍五入,完成后再看看是不是还可以,一循环下去,直到整数位,或者没时间了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <…
Codeforces 718A Efim and Strange Grade 程序分析 jerry的程序 using namespace std; typedef long long ll; string buf; int i; void up(int at) { at--; if (at < 0) { buf = '1' + buf; i++; return; } if (buf[at] == '.') at--; buf[at]++; if (buf[at] == '9'+1) { buf[…
题目链接:http://codeforces.com/problemset/problem/719/C C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a…
C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any po…
C. Efim and Strange Grade 题目连接: http://codeforces.com/contest/719/problem/C Description Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. First he got disappoin…
codeforces 373 A - Efim and Strange Grade(算数模拟) 原题:Efim and Strange Grade 题意:给出一个n位的实型数,你可以选择t次在任意位进行四舍五入的进位,求最大结果. 解法:这道题一定不能忽略数位计算时本身带来的进位,如果我们要改变这个数的大小,一定是在最先的那个出现5以上的数字进行四舍五入,之后的t次允许我们多次四舍五入,如果自然进位则不消耗t. 最后一点,整数位的进位也是需要考虑的 #include <cstdio> #inc…
C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any po…
Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any posit…
time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Efim just received his grade for the last test. He studies in a special school and his grade can be equal to any positive decimal fraction. F…
题目连接:Codeforces 437C  The Child and Toy 贪心,每条绳子都是须要割断的,那就先割断最大值相应的那部分周围的绳子. #include <iostream> #include <cstring> #include <cstdio> #include <algorithm> using namespace std; const int MAX_N = 1000 + 10; int G[MAX_N][MAX_N]; struct…