結果

問題 No.9000 Hello World! (テスト用)
ユーザー mamo_ICEmamo_ICE
提出日時 2019-04-14 12:32:55
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 5,000 ms
コード長 1,275 bytes
コンパイル時間 220 ms
コンパイル使用メモリ 7,156 KB
実行使用メモリ 6,392 KB
最終ジャッジ日時 2023-10-18 22:31:39
合計ジャッジ時間 739 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
6,392 KB
testcase_01 AC 11 ms
6,392 KB
testcase_02 AC 10 ms
6,392 KB
testcase_03 AC 11 ms
6,392 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# coding: utf-8
# !/usr/bin/python


# クラス定義
class HelloWorld(object):
    '''
    HelloWorldのコンテキストクラス
    '''

    def __enter__(self):
        '''
        __enter__
        '''
        self.__out = ''
        self.__string = ['0x48', '0x65', '0x6c', '0x6c', '0x6f', '0x20',
                         '0x57', '0x6f', '0x72', '0x6c', '0x64', '0x21']
        return self

    def __exit__(self, exc_type, exc_value, traceback):
        '''
        __exit__
        '''
        print(self.__out)
        return True

    def get_out(self):
        '''
        outのゲッター
        '''
        return self.__out

    def set_out(self, asc):
        '''
        outのセッター
        '''
        self.__out += chr(int(asc, 16))

    def get_string(self):
        '''
        stringのゲッター
        '''
        return self.__string

    # propertyの設定
    out = property(get_out, set_out)
    string = property(get_string)


# メインの処理
def main():
    count = ans = 0
    with HelloWorld() as hello:
        while True:
            ans = hello.string[count]
            hello.out = ans
            count += 1


# 直接呼び出されているか
if __name__ == '__main__':
    main()
else:
    print('Hello World!')
0