Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

虽然是水题,代码也要精简,来个191B的小代码

Posted by Eov_Second at 2016-12-09 14:10:45 on Problem 3917 and last updated at 2016-12-09 14:20:17
PRS三个字母换成2进制,取后三位刚好是023,以此为索引打表(3表示平局,2表示赢,1表示输)

main() {
    char s[80], t[80], *p, *q, c, m[] = "3321333313322313";
    int x[3];
    while (gets(s) && *s != 69) {
        gets(t);
        p = s;
        q = t;
        *x = x[1] = 0;
        while (c = *p++)x[m[(c & 3) * 4 + (*q++ & 3)] - 49]++;
        printf("P1: %d\nP2: %d\n", x[1], *x);
    }
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator