結果

問題 No.667 Mice's Luck(ネズミ達の運)
コンテスト
ユーザー subsn
提出日時 2023-06-19 15:49:35
言語 C90(gcc12)
(gcc 12.4.0)
コンパイル:
gcc-12 -O2 -std=c90 -DONLINE_JUDGE -o a.out _filename_ -lm
実行:
./a.out
結果
AC  
実行時間 35 ms / 2,000 ms
コード長 348 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 238 ms
コンパイル使用メモリ 29,892 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2026-03-08 16:35:03
合計ジャッジ時間 1,550 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:10:17: warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘char (*)[100001]’ [-Wformat=]
   10 |         scanf("%s",&s);
      |                ~^  ~~
      |                 |  |
      |                 |  char (*)[100001]
      |                 char *
main.c:10:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   10 |         scanf("%s",&s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #
raw source code

#include <stdio.h>
#include<string.h>
int main(i)
{
	double o,x,len,lens;
	o = 0;
	x = 0;
	char s[100001];
	memset(s, 0, sizeof(char) * 100001);
	scanf("%s",&s);
	len = strlen(s);
	lens = len;
	for (i = 0;i < len;i++) {
		s[i]=='o'?o++:x++;
	}
	for (i = 0;i < len;i++) {
		printf("%f\n", (double)o / lens * 100);
		s[i]=='o'?o--:x--;
		lens--;
	}
}
0