问题标题: 洛谷:P2007怎么写?

0
0

0
0
周思睿
周思睿
新手光能
新手光能
    long long a,b,c;
    cin>>a>>b>>c;
    if(a>b&&a>c)
    cout<<1<<endl;
    else cout<<0<<endl;
    if(b>a || b>c)
    cout<<1<<endl;
    else cout<<0<<endl;
    if(c<=a)
    cout<<1<<endl;
    else cout<<0<<endl;

核心

0
黄昊轩
黄昊轩
新手守护
新手守护

#include<cstdio> #include<iostream> #define f(i,a,b) for(register int i=a;i<=b;i++) #define fd(i,a,b) for(register int i=a;i>=b;i--) using namespace std; int mf[7][4][4]; string s; inline void change(char step) { int mf2[7][4][4]; f(i,1,6) f(j,1,3) f(k,1,3) mf2[i][j][k]=mf[i][j][k]; switch(step) { case '1': { f(i,1,3) { mf[1][i][3]=mf2[6][i][3]; mf[2][i][3]=mf2[5][i][3]; mf[5][i][3]=mf2[1][i][3]; mf[6][i][3]=mf2[2][i][3]; } f(i,1,3) f(j,1,3) mf[4][j][4-i]=mf2[4][i][j]; break; } case '2': { f(i,1,3) { mf[1][i][3]=mf2[5][i][3]; mf[2][i][3]=mf2[6][i][3]; mf[5][i][3]=mf2[2][i][3]; mf[6][i][3]=mf2[1][i][3]; } f(i,1,3) f(j,1,3) mf[4][4-j][i]=mf2[4][i][j]; break; } case '3': { f(i,1,3) { mf[1][1][i]=mf2[3][1][i]; mf[2][1][i]=mf2[4][1][i]; mf[3][1][i]=mf2[2][1][i]; mf[4][1][i]=mf2[1][1][i]; } f(i,1,3) f(j,1,3) mf[5][j][4-i]=mf2[5][i][j]; break; } case '4': { f(i,1,3) { mf[1][1][i]=mf2[4][1][i]; mf[2][1][i]=mf2[3][1][i]; mf[3][1][i]=mf2[1][1][i]; mf[4][1][i]=mf2[2][1][i]; } f(i,1,3) f(j,1,3) mf[5][4-j][i]=mf2[5][i][j]; break; } } } int main() { ios::sync_with_stdio(false); cin>>s; char c; f(i,1,6) f(j,1,3) f(k,1,3) cin>>c,mf[i][j][k]=c-'0'; f(i,0,s.size()-1) change(s[i]); f(i,1,6) f(j,1,3) { f(k,1,3) cout<<mf[i][j][k]; cout<<endl; } return 0; }

0
我要回答