版本比较
hyw
正文
增加 31 行删除 0 行
34 行未改动353637383940414243444546474849505152535455565758596061626364656667686934 行未改动 long long sum=(r-1)*m+c; cout<<sum;}``````cpp#include<bits/stdc++.h>using namespace std;bool r[10][10],c[10][10],t[10][10];int main(){ bool ok=true; for(int i=1;i<=9;i++){ string s; cin>>s; for(int j=1;j<=9;j++){ char ch=s[j-1]; if(ch!='.'){ int g=((i-1)/3)*3+(j-1)/3; if(r[i][ch-'0']==true||c[j][ch-'0']==true||t[g][ch-'0']==true){ ok=false; }else{ r[i][ch-'0']=true; c[j][ch-'0']=true; t[g][ch-'0']=true; } } } } if(ok==true){ cout<<"YES"; }else{ cout<<"NO"; } return 0;}```