#UVa:621-Secret Research

灆洢 2015-05-07 10:02:56

由於Pattern不具有混淆性,直接判斷即可。

C++(0.009)

/*******************************************************/
/* UVa 621 Secret Research                             */
/* Author: Maplewing [at] knightzone.studio            */
/* Version: 2015/05/07                                 */
/*******************************************************/
#include <iostream>
#include <cstdio>
using namespace std;

int main(){
  int n;
  while( scanf("%d", &n) != EOF ){
    string input;
    for( int i = 0 ; i < n ; ++i ){
      cin >> input;
      if( input[input.length()-2] == '3' && input[input.length()-1] == '5' ){
        printf("-\n");
      }
      else if( input[0] == '9' && input[input.length()-1] == '4' ){
        printf("*\n");
      }
      else if( input[0] == '1' && input[1] == '9' && input[2] == '0' ){
        printf("?\n");
      }
      else{
        printf("+\n");
      }
    }
  }
  return 0;
}

發表迴響

這個網站採用 Akismet 服務減少垃圾留言。進一步瞭解 Akismet 如何處理網站訪客的留言資料