zoj 2034 False Coin

zoj 2034 False Coin,第1张

zoj 2034 False Coin
#include "iostream"  #include "cstring"  #include "cstdio"  using namespace std;  int num[100][1001];         char s[1000];   short jd(int j, int *s, char c){      int m, f, i;      m = s[0] << 1;      for(i =1, f = 1; i <= m && f;){          if(s[i] == j)        f = 0;          else ++i;      }       if(!f && c == '=' || f && c != '='){          return 0;      }      return 1;  }  int main(){      int iCase, n, k, i, j, flage = 0;      cin>> iCase;          while(iCase--){          if(flage)   cout<<endl;          else   flage = 1;          cin >> n >> k;          memset(num, 0, sizeof(num));        memset(s, 0, sizeof(s));          for(i = 0; i < k; i++){       cin >> num[i][0];   int len = num[i][0] * 2;   for(j = 1; j <= len; j++){       cin >> num[i][j];   }   cin >> s[i];          }          int t, no;          for(i = 1, t = 0; i <= n; i++){          for(j = 0; j < k && jd(i, num[j], s[j]); j++);        if(j < k) continue;   t++;     if(t > 1)       break;   no = i;         }          if( t != 1)   cout<<0<<endl;          else    cout<<no<<endl;      }      return 0;  }

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/zaji/4925869.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-11-12
下一篇2022-11-12

发表评论

登录后才能评论

评论列表(0条)

    保存