[過去ログ] プログラミングのお題スレ Part13 (1002レス)
上下前次1-新
このスレッドは過去ログ倉庫に格納されています。
次スレ検索 歴削→次スレ 栞削→次スレ 過去ログメニュー
1(5): 2019/02/03(日)11:21 ID:72eosYJ+(1/3)調 AAS
プログラミングのお題スレです。
【出題と回答例】
1 名前:デフォルトの名無しさん
お題:お題本文
2 名前:デフォルトの名無しさん
>>1 使用言語
回答本文
結果がある場合はそれも
【ソースコードが長くなったら】 (オンラインでコードを実行できる)
https://ideone.com/
http://codepad.org/
http://compileonline.com/
http://rextester.com/runcode
https://runnable.com/
https://code.hackerearth.com/
http://melpon.org/wandbox
https://paiza.io/
宿題は宿題スレがあるのでそちらへ。
※前スレ
2chスレ:tech
2(1): 2019/02/03(日)11:24 ID:72eosYJ+(2/3)調 AAS
お題1: 現在地の緯度、経度を出せ
緯度:、、、、
経度:、、、、
お題2: 東京都新宿区西新宿2丁目8-1 の緯度、経度を出せ
緯度:、、、
経度:、、、
お題3: お題2で求めた緯度経度から住所を出せ
郵便番号:、、、
住所:東京都、、、、
3: 2019/02/03(日)11:36 ID:72eosYJ+(3/3)調 AAS
>>2 python (pythonista)
#お題1
import location
location.start_updates() # GPSデータ更新を開始
gps=location.get_location() # GPSデータを取得する
location.stop_updates()# GPSデータ更新を終了
print('お題1')
print('緯度:'+str(gps['latitude']))
print('経度:'+str(gps['longitude']))
#お題2
address_dict = {'Street': '西新宿2丁目8-1'}
gc = location.geocode(address_dict)[0]
print('お題2')
print('緯度:'+str(gc['latitude']))
print('経度:'+str(gc['longitude']))
#お題3
adr = location.reverse_geocode(gc)[0]
#print(adr)
print('お題3')
print('郵便番号:'+str(adr['ZIP']))
print('住所:'+str(adr['State'])+str(adr['City'])
+str(adr['Street']))
#結果
お題1
緯度:35.7----略
経度:139.6---略
お題2
緯度:35.689504
経度:139.6916833
お題3
郵便番号:160-0023
住所:東京都新宿区西新宿2丁目8番1号
4(3): 2019/02/03(日)13:16 ID:jFMT64Yy(1/2)調 AAS
平方数の判定は、たとえばmod 10だと、
1と4と5と6と9に限るってのを利用すると、違う場合は判定が速いんだろ。
mod n で複数やる。
1=1^2
4=2^2
9=3^2
6=4^2
5=5^2
6=6^2
9=7^2
4=8^2
1=9^2
5: 2019/02/03(日)17:42 ID:oUppVF8S(1)調 AAS
>>1
乙
6: 2019/02/03(日)18:09 ID:I0qputsI(1/4)調 AAS
>>4
平方根求められる関数と、少数を整数にする関数があれ
7(2): 2019/02/03(日)18:10 ID:I0qputsI(2/4)調 AAS
途中で送っちゃった。。。
あれば簡単。
def isSqr(x):
if sqrt(x) - int(sqrt(x)) == 0:
return True
else:
return False
def sqrt(x):
return (x ** 0.5)
上下前次1-新書関写板覧索設栞歴
あと 995 レスあります
スレ情報 赤レス抽出 画像レス抽出 歴の未読スレ AAサムネイル
ぬこの手 ぬこTOP 0.017s