結果
| 問題 | 
                            No.345 最小チワワ問題
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2018-03-20 21:55:14 | 
| 言語 | Nim  (2.2.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 317 bytes | 
| コンパイル時間 | 2,885 ms | 
| コンパイル使用メモリ | 65,380 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-30 04:58:49 | 
| 合計ジャッジ時間 | 3,819 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 17 WA * 12 | 
コンパイルメッセージ
/home/judge/data/code/Main.nim(1, 8) Warning: imported and not used: 'sequtils' [UnusedImport] /home/judge/data/code/Main.nim(1, 18) Warning: imported and not used: 'strutils' [UnusedImport]
ソースコード
import sequtils, strutils
var
    s = readLine(stdin)
    first = -1
    last = -1
proc main():int =
    for i,v in s:
        if v == 'c':
            first = i
        elif v == 'w' and first != -1:
            if last != -1:
                return (i + 1) - first
            last = i
    return -1
echo main()