fork download
  1. class FantomSay {
  2. Void main(Str[] args) {
  3. // your code goes here
  4. }
  5. }
Success #stdin #stdout 1.41s 105180KB
stdin
program SimpleHash
    implicit none

    character(len=*), parameter :: student_id = "202401348"
    character(len=*), parameter :: name = "KANE"

    character(len=100) :: data
    integer :: i
    integer(kind=8) :: hash

    data = trim(student_id) // trim(name)

    hash = 0

    do i = 1, len_trim(data)
        hash = mod(hash * 31 + ichar(data(i:i)), 1000000007_8)
    end do

    print *, "Student ID = ", student_id
    print *, "Name       = ", name
    print *, "Hash Value = ", hash

end program SimpleHash
stdout
Standard output is empty