问题标题: 1

0
0
已解决
周炜骐
周炜骐
中级光能
中级光能
#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<cstring>
#include<windows.h>
using namespace std;
int a[10][100]={{0},
             {0,37,35,1,25,19,41,11,29},
             {0,13,39,24,32,4,36,42,16},
             {0,2,27,38,17,14,5,3,8},
             {0,33,21,34,10,26,30,22,7},
             {0,40,43,15,18,31,12,23,6},
             {0,0,0,20,28,0,9,0,0}
},b[10][100],day=27,mon=11,year=2023,m[20]={0,31,30,31,30,31,30,31,31,30,31,30,31};
int main(){
    while(1){
        for(int i=1;i<=5;i++){
            for(int j=1;j<=8;j++){
                if(i-1!=0&&j+1!=9){
                    b[i-1][j+1]=a[i][j];
                }else{
                    if(i==1&&j==8){
                        b[5][1]=a[i][j];
                    }
                    if(i==1){
                        b[5][j+1]=a[i][j];
                    }
                    if(j==8){
                        b[i-1][1]=a[i][j];
                    }
                }
            }
        }
        for(int i=1;i<=8;i++){
            b[6][i]=a[6][i];
        }
        int x;
        if(b[6][3]==22){
            x=1;
        }else{
            x=b[6][3]+1;
        }
        if(x==9){
            x++;
        }
        for(int i=1;i<=5;i++){
            for(int j=1;j<=8;j++){
                if(x==b[i][j]){
                    swap(b[6][3],b[i][j]);
                    break;
                }
            }
        }
        if(b[6][4]==43){
            x=23;
        }else{
            x=b[6][4]+1;
        }
        for(int i=1;i<=5;i++){
            for(int j=1;j<=8;j++){
                if(x==b[i][j]){
                    swap(b[6][4],b[i][j]);
                    break;
                }
            }
        }
        for(int i=1;i<=6;i++){
            for(int j=1;j<=8;j++){
                a[i][j]=b[i][j];
                if(b[i][j]==0){
                    cout<<"   ";
                    continue;
                }
                if(b[i][j]/10!=0){
                    cout<<b[i][j]<<" ";
                }else{
                    cout<<b[i][j]<<"  ";
                }
            }
            cout<<endl;
        }
        for(int i=1;i<=120;i++){
            cout<<'+';
        }
        day+=7;
        if(year%4==0){
            if(year%100==0){
                if(year%400==0){
                    m[2]++;
                }
            }else{
                m[2]++;
            }
        }
        if(day>m[mon]){
            day-=m[mon];
            mon++;
        }
        if(mon>12){
            mon=1;
            year++;
        }
        cout<<"    $   -year:"<<year<<"-  -mon:"<<mon<<"-  -day:"<<day<<"-   $    \n***|";
        for(int i=1;i<=5;i++){
            for(int j=1;j<=8;j++){
                if(a[i][j]==20){//if(a[i][j]==19)为19的同桌
                    if(i==6&&j==3){
                        cout<<28;//20--28 19--27  18--26……
                        break;
                    }
                    if(j%2==1){
                        cout<<a[i][j+1];
                    }else{
                        cout<<a[i][j-1];
                    }
                    break;
                }
            }
        }
        cout<<"|***\n***|";
        for(int i=1;i<=5;i++){
            for(int j=1;j<=8;j++){
                if(a[i][j]==19){//如上
                    if(i==6&&j==3){
                        cout<<27;
                        break;
                    }
                    if(j%2==1){
                        cout<<a[i][j+1];
                    }else{
                        cout<<a[i][j-1];
                    }
                    break;
                }
            }
        }
        cout<<"|***\n";
        for(int i=1;i<=120;i++){
            cout<<'-';
        }
        cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n";
        Sleep(1000);
    }
    return 0;
}

 


0
0
周炜骐
周炜骐
中级光能
中级光能

#include<iostream>
#include<cstdio>
#include<string>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<cstdlib>
#include<queue>
#include<cstring>
using namespace std;
string a;
int main(){
    getline(cin,a);
    int tmp=a.size();
    for(int i=1;i<=tmp;i++){
        bool flag=0;
        string s=a.substr(0,i);
        for(int j=0;j<tmp;j+=i){
            string t=a.substr(j,j+i);
            if(s!=t){
                flag=1;
            }
        }
        if(!flag){
            cout<<i;
            break;
        }
    }
    return 0;
}

0
我要回答