Submission #235839


Source Code Expand

#include <iostream>
#include <stdio.h>
#include <istream>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <cstdio>
#include <queue>
#include <unordered_set>
#include <unordered_map>
#include <complex>
#include <iomanip>


using namespace std;

typedef long long int ll;
typedef unsigned long long ull;
typedef pair<int,int> pi;
typedef pair<long, long> pl;
typedef pair<double, double> pd;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vi> vii;
typedef vector<vl> vll;
typedef vector<double> vec;
typedef vector<vec> mat;
typedef map<int, int> mii;
void dumppi(const pi &p) {  cout << p.first  << ' ' << p.second << endl; }
typedef pair<long, long> pl;
void dumppl(const pl &p) { cout << p.first << ' ' << p.second << endl; }
typedef vector<pi> vpi;
void dumpvpi(const vpi &vec) { for (auto v : vec) { cout << '(' << v.first << ',' << v.second << ')' << ' '; } cout << endl; }
typedef vector<bool> vb;
void dumpvb(const vb &vec) { for (auto b : vec) { cout << b << ' '; } cout << endl; }
typedef vector<int> vi;
void dumpvi(const vi &vec) { for (auto i : vec) { cout << i << ' '; } cout << endl; }
typedef vector<pl> vpl;
void dumpvpi(const vpl &vec) { for (auto v : vec) { cout << '(' << v.first << ',' << v.second << ')' << ' '; } cout << endl; }
typedef vector<vi> vii;
void dumpvii(const vii &mat) {for (auto vec : mat) {for (auto v : vec){cout << v << ' ';} cout << endl;}}


// util macro
// ----------------------------------------
#define mp make_pair
#define pb push_back
//-----------------------------------------

// iterator
// ----------------------------------------
#define all(x) (x).begin(), (x).end()
// ----------------------------------------

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
//------------------------------------------

const int INF = 1e9;
const double EPS = 1e-10;
const int dx[] = {-1, 0, 1, 0};
const int dy[] = { 0,-1, 0, 1};

const int mod = 1000000007;
const double g = 9.8;

// POINTS
//-------------------------------------------
typedef complex<double> point;
// X : real();
// Y : imag();
double dot(point a, point b){  // inner product
    return (a * conj(b)).real();
}
double cross(point a, point b){ // outer product
    return (a * conj(b)).imag();
}
double dist(point a, point b) {
    return dot(a-b, a-b);
}
typedef vector<point> vpoint;
//-------------------------------------------

// math
//-------------------------------------------
int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}
ll extgcd(ll a, ll b, ll& x, ll& y) {
    ll d = a;
    if (b != 0) {
        d = extgcd(b, a % b, y, x);
        y -= (a / b) * x;
    } else {
        x = 1; y = 0;
    }
    return d;
}
ll mod_pow(ll x, ll n) {
    if (n==0) return 1;
    ll res = mod_pow(x * x % mod, n / 2);
    if (n & 1) res = res * x % mod;
    return res;
}
ll m_fact(ll n) {
    ll res = 1; for (int i = 2; i <= n; i++) { res = res * i % mod; } return res;
}
ll mod_inverse(ll a) {
    ll x, y;
    extgcd(a, mod, x, y);
    return (mod + x % mod) % mod;
}
ll mod_fact(ll n, ll &e) {
    e = 0;
    if (n == 0) return 1;
    ll res = mod_fact(n / mod, e);
    e += n / mod;
    if (n / mod % 2 != 0) return res * (mod - m_fact(n % mod)) % mod;
    return res * m_fact(n % mod) % mod;
}

ll mod_comb(int n, int k) {
    if (n < 0 || k < 0 || n < k) return 0;
    ll e1, e2, e3;
    ll a1 = mod_fact(n, e1), a2 = mod_fact(k, e2), a3 = mod_fact(n-k, e3);
    if (e1 + e2 > e3) return 0;
    return a1 * mod_inverse(a2 * a3 % mod);
}
//-------------------------------------------


//-------------------------------------------
// Union Find
class uf {
private:
    vl _par = vl(0);
    vl _rank = vl(0);
public:
    uf(const ll n) {
        _par = vl(n); _rank = vl(n);
        for (ll i = 0; i < n; i++) {
            _par.at(i) = i;
            _rank.at(i) = 0;
        }
    }
    
    ll find(ll x) {
        if (_par.at(x) == x) { return x; }
        else { return _par.at(x) = find(_par.at(x)); }
    }
    
    void unite(ll x, ll y) {
        x = find(x); y = find(y);
        if (x == y) return;
        if (_rank.at(x) < _rank.at(y)) { _par.at(x) = y; }
        else { _par.at(y) = x; if (_rank.at(x) == _rank.at(y)) { _rank.at(x)++; } }
    }
    bool same(ll x, ll y) { return find(x) == find(y); }
};

//-------------------------------------------


#define  debu 0

ll uruu(ll x) {
    return (x / 4) - (x / 100) + (x / 400);
}

int main(int argc, const char * argv[])
{
    ios::sync_with_stdio(false);
    
    ll A, B;
    
    cin >> A >> B;
#if debu
    cout << uruu(A) << endl;
    cout << uruu(B) << endl;
#endif
    
    cout << uruu(B) - uruu(A-1) << endl;
    
}

Submission Info

Submission Time
Task C - 2月29日
User nida_001
Language C++11 (GCC 4.8.1)
Score 100
Code Size 5090 Byte
Status AC
Exec Time 34 ms
Memory 1060 KiB

Judge Result

Set Name sub All
Score / Max Score 25 / 25 75 / 75
Status
AC × 10
AC × 19
Set Name Test Cases
sub test_01A.txt, test_02A.txt, test_03A.txt, test_04A.txt, test_05A.txt, test_07A.txt, test_09A.txt, test_11A.txt, test_13A.txt, test_15A.txt
All test_01A.txt, test_02A.txt, test_03A.txt, test_04A.txt, test_05A.txt, test_06.txt, test_07A.txt, test_08.txt, test_09A.txt, test_10.txt, test_11A.txt, test_12.txt, test_13A.txt, test_14.txt, test_15A.txt, test_16.txt, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
sample_01.txt AC 28 ms 1044 KiB
sample_02.txt AC 29 ms 1060 KiB
sample_03.txt AC 32 ms 988 KiB
test_01A.txt AC 29 ms 940 KiB
test_02A.txt AC 31 ms 1052 KiB
test_03A.txt AC 29 ms 940 KiB
test_04A.txt AC 30 ms 940 KiB
test_05A.txt AC 31 ms 1044 KiB
test_06.txt AC 28 ms 1044 KiB
test_07A.txt AC 27 ms 1048 KiB
test_08.txt AC 29 ms 1004 KiB
test_09A.txt AC 29 ms 1004 KiB
test_10.txt AC 28 ms 1048 KiB
test_11A.txt AC 28 ms 1048 KiB
test_12.txt AC 28 ms 1044 KiB
test_13A.txt AC 31 ms 980 KiB
test_14.txt AC 34 ms 996 KiB
test_15A.txt AC 28 ms 1040 KiB
test_16.txt AC 30 ms 964 KiB