結果

問題 No.418 ミンミンゼミ
ユーザー dai11dai11
提出日時 2017-07-19 09:50:16
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 481 bytes
コンパイル時間 1,263 ms
コンパイル使用メモリ 157,344 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 02:23:02
合計ジャッジ時間 2,164 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:11:11: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[100]’ [-Wformat=]
   11 |   scanf("%s",&S);     //入力値
      |          ~^  ~~
      |           |  |
      |           |  char (*)[100]
      |           char*
main.cpp:11:8: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |   scanf("%s",&S);     //入力値
      |   ~~~~~^~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main(int argc, char **argv)
{
  char S[100];        //蝉がどのように鳴いたかの文字列
  int  i;             //ループカウンタ
  int  count = 0;     //minまたは、mi--nと鳴いたカウント値
  
  scanf("%s",&S);     //入力値
  
  for(i=0;i<strlen(S);i++)
  {
    if('n' == S[i])   //minまたは、mi--nと鳴いた時の条件
    {
      count++;
    }
  }
  
  printf("%d\n",count);
  return 0;
}
0