結果
| 問題 |
No.346 チワワ数え上げ問題
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-01-19 16:46:45 |
| 言語 | Nim (2.2.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 314 bytes |
| コンパイル時間 | 3,027 ms |
| コンパイル使用メモリ | 66,688 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-01 10:22:00 |
| 合計ジャッジ時間 | 4,217 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 17) Warning: imported and not used: 'strutils' [UnusedImport] /home/judge/data/code/Main.nim(1, 54) Warning: imported and not used: 'strformat' [UnusedImport] /home/judge/data/code/Main.nim(1, 36) Warning: imported and not used: 'math' [UnusedImport] /home/judge/data/code/Main.nim(1, 41) Warning: imported and not used: 'sugar' [UnusedImport] /home/judge/data/code/Main.nim(1, 47) Warning: imported and not used: 'macros' [UnusedImport]
ソースコード
import sequtils,strutils,algorithm,math,sugar,macros,strformat
proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .}
let S = stdin.readLine()
var w = 0
var ans = 0
for s in S.reversed():
if s == 'w':
w += 1
continue
if s != 'c' : continue
ans += w * (w-1) div 2
echo ans