結果
| 問題 |
No.380 悪の台本
|
| コンテスト | |
| ユーザー |
jj
|
| 提出日時 | 2017-03-19 00:31:33 |
| 言語 | Fortran (gFortran 14.2.0) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 2,272 bytes |
| コンパイル時間 | 1,428 ms |
| コンパイル使用メモリ | 32,128 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-06 23:22:26 |
| 合計ジャッジ時間 | 2,285 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | RE * 2 |
| other | WA * 2 RE * 6 |
ソースコード
subroutine correct()
print '("CORRECT (maybe)")'
end subroutine correct
subroutine wrong()
print '("WRONG!")'
end subroutine wrong
function is_kigou(c) result(l)
character::c
integer::cnum
logical::l
cnum=ICHAR(c)
l = .not.(((ICHAR('0')<=cnum).and.(cnum<=ICHAR('9'))).or. &
((ICHAR('a')<=cnum).and.(cnum<=ICHAR('z'))))
end function is_kigou
program main
implicit none
interface
subroutine wrong()
end subroutine wrong
subroutine correct()
end subroutine correct
end interface
integer::N,len,i
logical::l
character*100000::S
do
read (*,'(1000a)') S
if(S =="") exit
len=LEN_TRIM(S)
if(len.le.5) then
call wrong()
cycle
end if
call lowering(S)
if(S(1:4)=="digi") then
l = search(S, "nyo")
else if(S(1:5)=="petit") then
l = search(S,"nyu")
else if(S(1:4)=="rabi") then
l = rabi(S)
else if(S(1:4)=="gema") then
l = search(S,"gema")
else if(S(1:4)=="piyo") then
l = search(S,"pyo")
end if
if(l.eqv..true.) then
call correct()
else
call wrong()
end if
end do
contains
subroutine lowering(S)
character*100000::S
integer::snum
do i=1,len
snum=ICHAR(S(i:i))
if((65<=snum).and.(snum<=90)) S(i:i)=ACHAR(snum+32)
end do
end subroutine lowering
function search(S,pattern) result(l)
interface
function is_kigou(c) result(l)
character::c
logical::l
end function is_kigou
end interface
integer::i
logical::l
character*100000::S
character*3,intent(in)::pattern
l = .false.
do i=0,3
if(S(len-2-i:len-i)==pattern) then
l = .true.
return
end if
if(.not.(is_kigou(S(len-i:len-i)))) then
exit
end if
end do
end function search
function rabi(S) result(l)
interface
function is_kigou(c) result(l)
character::c
logical::l
end function is_kigou
end interface
integer::i
logical::l
character*100000::S
l = .false.
do i=5,len
if(.not.(is_kigou(S(i:i)))) then
l = .true.
return
end if
end do
end function rabi
end program main
jj