結果

問題 No.418 ミンミンゼミ
ユーザー AQUA16573837AQUA16573837
提出日時 2018-03-12 01:11:53
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 1 ms / 1,000 ms
コード長 258 bytes
コンパイル時間 309 ms
コンパイル使用メモリ 33,608 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-16 02:32:44
合計ジャッジ時間 936 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         scanf("%s", s);
      |         ~~~~~^~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <algorithm>
using namespace std;
using ll = long long;

//418
int main() {
	char s[101];
	scanf("%s", s);
	int p, c = 0;
	for (p = 0; s[p] != 0; ) {
		p += 2;
		while (s[p] == '-')
			p++;
		p += 1;
		c++;
	}
	printf("%d\n", c);
}
0