Submission #6601341


Source Code Expand

#include<iostream>
#include<cstdio>
using namespace std;
int months[13]={0,31,0,31,30,31,30,31,31,30,31,30,31};

bool isrun(int year)
{
    if(year%4==0 && year%100!=0)return 1;
    if(year%400==0)return 1;
    return 0;
}

bool judge()
{
    if(a%b==0 && (a/b)%c==0)return 1;
    return 0;
}

int main()
{
    int a,b,c;
    scanf("%d/%d/%d",&a,&b,&c);
    if(isrun(a))months[2]=29;
    else months[2]=28;
    while(!judge())
    {
        c++;
        if(c>months[b]){c=1;b++;}
        if(b>12)
        {
            b=1;a++;
            if(isrun(a))months[2]=29;
            else months[2]=28;
        }
    }
    cout<<a<<'/'<<b<<'/'<<c;
}

Submission Info

Submission Time
Task B - 割り切れる日付
User luogu_bot5
Language C++14 (GCC 5.4.1)
Score 0
Code Size 643 Byte
Status CE

Compile Error

./Main.cpp: In function ‘bool judge()’:
./Main.cpp:15:8: error: ‘a’ was not declared in this scope
     if(a%b==0 && (a/b)%c==0)return 1;
        ^
./Main.cpp:15:10: error: ‘b’ was not declared in this scope
     if(a%b==0 && (a/b)%c==0)return 1;
          ^
./Main.cpp:15:24: error: ‘c’ was not declared in this scope
     if(a%b==0 && (a/b)%c==0)return 1;
                        ^
./Main.cpp: In function ‘int main()’:
./Main.cpp:22:31: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d/%d/%d",&a,&b,&c);
                               ^