結果
問題 | No.150 "良問"(良問とは言っていない |
ユーザー |
![]() |
提出日時 | 2021-03-23 18:33:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 157 ms / 5,000 ms |
コード長 | 717 bytes |
コンパイル時間 | 419 ms |
コンパイル使用メモリ | 82,260 KB |
実行使用メモリ | 78,252 KB |
最終ジャッジ日時 | 2024-11-25 10:02:00 |
合計ジャッジ時間 | 3,373 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 20 |
ソースコード
#!/usr/bin/env python3 #coding:utf-8 import math import string from sys import stdin # import numpy as np # from matplotlib import pyplot as plt def main(): read=stdin.readline #edit here! t=int(read()) while t>0: t-=1 s=read() n=len(s) n-=1 ans=n good=lambda a,b,c,d:(a!='g')+(b!='o')+(c!='o')+(d!='d') problem=lambda a,b,c,d,e,f,g:(a!='p')+(b!='r')+(c!='o')+(d!='b')+(e!='l')+(f!='e')+(g!='m') for i in range(n-10): res=0 res+=good(s[i],s[i+1],s[i+2],s[i+3]) minv=n for j in range(n-i-10): minv=min(minv,problem(s[i+4+j],s[i+4+j+1],s[i+4+j+2],s[i+4+j+3],s[i+4+j+4],s[i+4+j+5],s[i+4+j+6])) res+=minv ans=min(ans,res) print(ans) if __name__ == '__main__': main()