square869120Contest #3

Submission #1193639

Source codeソースコード

#include<iostream>
#include<cstdio>
#include<cmath>
#include<cstring>
#include<string>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include <iomanip>
typedef long long int ll;
using namespace std;
#define FOR(i,a,b) for (int i=(a);i<(b);i++)
#define REP(i,n) for (int i=0;i<(n);i++)
#define EREP(i,n) for (int i=1;i<=(n);i++)
#define EVEL 1
#define KETA 2
#ifndef EVEL
#define DEB(X) cout << #X << ":" <<std::setw(KETA) << std::setfill('0')<<X<<" " ;
#define TF(f) f ? cout<<"true  " : cout<<"false ";
#define END cout<<"\n";
#else
#define DEB(X) {X;}
#define TF(f) {f;}
#define END {}
#endif
const int MOD = 1000000007;
const int INF = 1000000;
#define NMAX 50
//#define MAX 10

    ll N,K,id=9;
    ll A[100010],sum=0,ans=0;


int main(){
    ios_base::sync_with_stdio(false);
    cin>>N>>K;
    int temp=(N+11-2)%11;
    if(N-2<0)ans=0;
    else ans+=((N-2)/11)*5;

        REP(i,temp+1){
            ll a=id;
            REP(j,5){
                if(i==0||i==N-1)break;
                    if(j==0){
                        sum=a*9;
                    }else{
                        a++;
                        sum=a*9;
                    }
                    DEB(sum%11)
                    if(sum%11==K){ans++;}
            }
            END;
            if(!(i==0||i==N-1))id+=7;
            //DEB(id) END
        }

    cout<<ans<<endl;
}

Submission

Task問題 A - カレンダー / Calendar
User nameユーザ名 Nafmo
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 AC
Score得点 250
Source lengthソースコード長 1438 Byte
File nameファイル名
Exec time実行時間 1 ms
Memory usageメモリ使用量 256 KB

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_1.txt,sample_2.txt,sample_3.txt,sample_4.txt
Subtask1 150 / 150 sample_1.txt,sample_2.txt,sample_3.txt,sample_4.txt,sub1_in1.txt,sub1_in2.txt,sub1_in3.txt,sub1_in4.txt,sub1_in5.txt,sub1_in6.txt,sub1_in7.txt,sub1_in8.txt,sub1_in9.txt
Subtask2 100 / 100 sample_1.txt,sample_2.txt,sample_3.txt,sample_4.txt,sub1_in1.txt,sub1_in2.txt,sub1_in3.txt,sub1_in4.txt,sub1_in5.txt,sub1_in6.txt,sub1_in7.txt,sub1_in8.txt,sub1_in9.txt,sub2_in1.txt,sub2_in2.txt,sub2_in3.txt,sub2_in4.txt,sub2_in5.txt,sub2_in6.txt,sub2_in7.txt,sub2_in8.txt,sub2_in9.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_1.txt AC 1 ms 256 KB
sample_2.txt AC 1 ms 256 KB
sample_3.txt AC 1 ms 256 KB
sample_4.txt AC 1 ms 256 KB
sub1_in1.txt AC 1 ms 256 KB
sub1_in2.txt AC 1 ms 256 KB
sub1_in3.txt AC 1 ms 256 KB
sub1_in4.txt AC 1 ms 256 KB
sub1_in5.txt AC 1 ms 256 KB
sub1_in6.txt AC 1 ms 256 KB
sub1_in7.txt AC 1 ms 256 KB
sub1_in8.txt AC 1 ms 256 KB
sub1_in9.txt AC 1 ms 256 KB
sub2_in1.txt AC 1 ms 256 KB
sub2_in2.txt AC 1 ms 256 KB
sub2_in3.txt AC 1 ms 256 KB
sub2_in4.txt AC 1 ms 256 KB
sub2_in5.txt AC 1 ms 256 KB
sub2_in6.txt AC 1 ms 256 KB
sub2_in7.txt AC 1 ms 256 KB
sub2_in8.txt AC 1 ms 256 KB
sub2_in9.txt AC 1 ms 256 KB