记录编号 |
575383 |
评测结果 |
AAAAA |
题目名称 |
Cafe Stella |
最终得分 |
100 |
用户昵称 |
00000 |
是否通过 |
通过 |
代码语言 |
C++ |
运行时间 |
0.000 s |
提交时间 |
2022-09-13 11:16:22 |
内存使用 |
0.00 MiB |
显示代码纯文本
- #include<bits/stdc++.h>
- #define ll long long
- using namespace std;
- int n;
- string a[20][20];
- int mark[20][20];
- int ans[20],k;
- int flag=0;
- char p;
- int fnd(int x,int y)
- {
- p=a[x][y][0];
- for(int q=1;q<=n;q++)
- {
- if(a[1][q][0]==p)
- {
- return q;
- }
- }
- }
- int check(void)
- {
- for(int q=2;q<=n;q++)
- {
- for(int w=2;w<=n;w++)
- {
-
- int a,b,c;
- a=ans[q],b=ans[w],c=ans[fnd(q,w)]+(n-1)*mark[q][w];
- // cout<<a<<" "<<b<<" "<<c<<endl;
- if(a+b!=c) return 1;
- }
- }
- return 0;
- }
- int main(){
- freopen("murasame_adultxp3.in","r",stdin);
- freopen("murasame_adultxp3.out","w",stdout);
- cin>>n;//n-1进制
- for(int q=1;q<=n;q++)
- {
- for(int w=1;w<=n;w++)
- {
- cin>>a[q][w];
- if(a[q][w].length()!=1)
- {
- flag=1;
- p=a[q][w][0];
- a[q][w]=a[q][w][1];
- mark[q][w]=1;
- }
- }
- }
- if(flag==0)
- {
- cout<<"FccKcuf";return 0;
- }
- int one;
- for(int q=1;q<=n;q++)
- {
- if(a[1][q][0]==p)
- {
- ans[q]=1;one=q;//记录等于一的位置
- }
- }
- int z=1;
- int po=one;//记录此位
- for(int q=2;q<=n-1;q++)
- {
- po=fnd(one,po);
- ans[po]=q;
- }
- ans[po]=0;
- if(check())
- {
- cout<<"FccKcuf";return 0;
- }
- for(int q=2;q<=n;q++)
- {
- cout<<a[1][q]<<"="<<ans[q]<<" ";
- }
- cout<<endl<<n-1;
- return 0;
- }
-
-
-
-
-