CodeForces 194A Exams

题意:给出两个数字,n和k,每次考试最少得2分,最多5分,判断总分到达k时,保证最高分尽可能低的情况下,最多能几次得2分

链接:http://codeforces.com/problemset/problem/194/A

思路:通过公式推导得出最多能有3*n-k个2分

注意点:无


以下为AC代码:

# Author Problem Lang Verdict Time Memory Sent Judged
9732248 Practice:
luminous11
194A - 11 GNU C++11 Accepted 30 ms 4 KB 2015-02-06 02:37:04 2015-02-06 02:37:04
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#define ll long long
#define ull unsigned long long
#define all(x) (x).begin(), (x).end()
#define clr(a, v) memset( a , v , sizeof(a) )
#define pb push_back
#define mp make_pair
#define read(f) freopen(f, "r", stdin)
#define write(f) freopen(f, "w", stdout)
using namespace std;
const double pi = acos(-1);
int main()
{
    ios::sync_with_stdio( false );
    int m, n;
    while ( cin >> m >> n ){
        if ( 3 * m - n > 0 )
            cout << 3 * m - n << endl;
        else
            cout << 0 << endl;
    }
    return 0;
}


你可能感兴趣的:(数论,CodeForces,模拟)