結果
| 問題 | No.2925 2-Letter Shiritori | 
| コンテスト | |
| ユーザー |  tnakao0123 | 
| 提出日時 | 2024-10-14 12:53:55 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 63 ms / 2,000 ms | 
| コード長 | 530 bytes | 
| コンパイル時間 | 241 ms | 
| コンパイル使用メモリ | 39,552 KB | 
| 最終ジャッジ日時 | 2025-02-24 19:25:37 | 
| ジャッジサーバーID (参考情報) | judge5 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 10 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   15 |   scanf("%s", s);
      |   ~~~~~^~~~~~~~~
main.cpp:22:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   22 |     scanf("%s%s", op, s);
      |     ~~~~~^~~~~~~~~~~~~~~
            
            ソースコード
/* -*- coding: utf-8 -*-
 *
 * 2925.cc:  No.2925 2-Letter Shiritori - yukicoder
 */
#include<cstdio>
#include<algorithm>
using namespace std;
/* main */
int main() {
  char s[4];
  scanf("%s", s);
  int st = s[0] - 'a';
  printf("? %c%c\n", 'a' + st, 'a' + st); fflush(stdout);
	 
  for (;;) {
    char op[4], s[4];
    scanf("%s%s", op, s);
    if (op[0] == '?') {
      int u = s[0] - 'a', v = s[1] - 'a';
      printf("? %c%c\n", 'a' + v, 'a' + st); fflush(stdout);
    }
    else {
      break;
    }
  }
  return 0;
}
            
            
            
        