結果
| 問題 |
No.557 点対称
|
| ユーザー |
|
| 提出日時 | 2017-08-11 23:17:42 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 94 ms / 2,000 ms |
| コード長 | 437 bytes |
| コンパイル時間 | 245 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,288 KB |
| 最終ジャッジ日時 | 2024-10-12 21:50:56 |
| 合計ジャッジ時間 | 3,694 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
コンパイルメッセージ
Main.rb:43: warning: `%' after local variable or literal is interpreted as binary operator Main.rb:43: warning: even though it seems like string literal Syntax OK
ソースコード
n = gets.to_i
if n == 1
p 2
exit
end
if n == 2
p 4
exit
end
def powm(x, q, mod=1000000007)
y=1
x=x%mod
while (0<q)
y=(y*x)%mod if q%2==1
x=(x*x)%mod
q/=2
end
return y
end
#7 => 2
#oxx?xxo
#oxxxxo
# 1869
top = 1
# 18690
middle = n/2-1
# 180
# center
result = 1
result *= top*4
result *= powm(5,middle)
result *= 3 if n.odd?
result = result %1000000007
p result