2 条题解

  • 0
    @ 2019-05-10 19:10:30

    #include <iostream>
    using namespace std;
    int TS(int year,int month)
    {
    bool rn=0;
    int day;
    if((year%4==0 && year%100!=0) || year%400==0)
    {
    rn=1;
    }
    if(month==2)
    {
    if(rn) day=29;
    else day=28;
    }
    else if(month==1 || month==3 || month==5 || month==7 || month==8 || month==10 ||month==12)
    {
    day=31;
    }
    else day=30;
    return day;
    }
    int main(){
    int date1,date2;
    cin>>date1>>date2;
    int date,year;
    int ans=0;
    for(year=date1/10000;year<=date2/10000;year++)
    {
    date=year*10000+year%10*1000+year%100/10*100+year%1000/100*10+year/1000;
    if(date>=date1 && date<=date2 && date%10000/100>0 && date%10000/100<=12 && date%100<=TS(year,date%10000/100))
    {
    ans++;
    }
    }
    cout<<ans;
    return 0;
    }

  • 0
    @ 2019-03-31 16:38:14

    #include<iostream>
    #include<cstdio>
    #include<cstring>
    using namespace std;
    char str[10],temp[10];
    int n;
    bool vis[10];
    void dfs(int step)
    {
    if(step==n)
    {
    temp[step]='\0';
    cout<<temp<<endl;
    }

    for(int i=0;i<n;i++)
    if(vis[i]==0)
    {
    vis[i]=1;
    temp[step]=str[i];
    dfs(step+1);
    vis[i]=0;
    }
    }
    int main()
    {
    memset(vis,0,sizeof(vis));
    cin>>str;
    n=strlen(str);
    dfs(0);
    return 0;
    }

  • 1

信息

难度
6
分类
(无)
标签
递交数
50
已通过
14
通过率
28%
上传者