結果

問題 No.648  お や す み 
コンテスト
ユーザー ciel
提出日時 2017-10-06 01:12:23
言語 Python2
(2.7.18)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 567 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 192 ms
コンパイル使用メモリ 7,972 KB
最終ジャッジ日時 2025-12-04 00:40:19
ジャッジサーバーID
(参考情報)
judge2 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 84
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#!/usr/bin/env python
import sys,ctypes
if sys.platform.startswith('linux'):
	libm=ctypes.cdll.LoadLibrary('libm.so.6')
	libc=ctypes.cdll.LoadLibrary('libc.so.6')
elif sys.platform=='darwin':
	libm=ctypes.cdll.LoadLibrary('libSystem.dylib')
	libc=libm
elif sys.platform=='win32':
	libm=ctypes.cdll.LoadLibrary('msvcr120.dll')
	libc=libm
else:
	raise ImportError

libm.sqrtl.restype=ctypes.c_longdouble
n=ctypes.c_longdouble()
z=int(sys.stdin.readline())*8+1
libc.sscanf(str(z),'%Lf',ctypes.byref(n))
n=libm.sqrtl(n)
q=int(n)
print('NO' if q*q!=z else 'YES\n%d'%(q/2))
0