結果
| 問題 |
No.495 (^^*) Easy
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-07-05 09:52:28 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 686 bytes |
| コンパイル時間 | 1,172 ms |
| コンパイル使用メモリ | 158,440 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-05 19:45:38 |
| 合計ジャッジ時間 | 1,621 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 7 |
コンパイルメッセージ
main.cpp: In function ‘int main(int, char**)’:
main.cpp:20:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[100000]’ [-Wformat=]
20 | scanf("%s",&S); //入力する文字列
| ~^ ~~
| | |
| | char (*)[100000]
| char*
main.cpp:20:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
20 | scanf("%s",&S); //入力する文字列
| ~~~~~^~~~~~~~~
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main(int argc, char **argv)
{
int i; //ループカウンタ
int t; //文字列を数値として格納
int k; //左向きのカウンタ
int y; //右向きのカウンタ
char S[100000]; //格納する文字列
//初期化
i = 0;
t = 0;
k = 0;
y = 0;
scanf("%s",&S); //入力する文字列
t = strlen(S); //文字列を数値として置き換える
for(i = 1;i<=t;i=i+5) //文字列の数だけループする
{
if('^' == S[i]) //左向きの条件
{
k++;
}
else if('*' == S[i]) //右向きの条件
{
y++;
}
}
printf("%d %d\n",k,y);
return 0;
}