Skip to content

Instantly share code, notes, and snippets.

View nukopy's full-sized avatar

Yosuke Okuwaki nukopy

View GitHub Profile
@nukopy
nukopy / padding.cpp
Created January 2, 2019 07:58
Padding with STL, "ios", "iomanip" on C++.
// 左埋めパディング
// 必用なヘッダーインクルード
#include <ios> // std::left, std::right
#include <iomanip> // std::setw(int), std::setfill(char)
// macro 直後の要素をパディング
#define zero_pad(num) setfill('0') << std::right << setw(num)
#define space_pad(num) setfill(' ') << std::right << setw(num)
// std::left とすれば,右に '0' を埋めることができる
@nukopy
nukopy / abc060b.cpp
Created November 26, 2018 07:11
ABC060 B - Choice Intergers
#include <iostream>
using namespace std;
int main() {
int A, B, C;
cin >> A >> B >> C;
for (int i = 1; i <= B; ++i) {
if (A*i%B == C) {
cout << "YES" << "\n";
@nukopy
nukopy / load_json_to_dict.py
Created August 30, 2018 15:47
Convert JSON file to Python dict
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
"""
explanation of json-module
json.load(file_obj) : file_obj --> dict
json.loads(json_str) : json_str --> dict
json.dumps(dict) : dict --> json_str
@nukopy
nukopy / dict2json.py
Created August 30, 2018 15:36
Generate JSON file from Python-dict: Convert dict-variables to JSON file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
"""
explanation of json-module
json.load(file_obj) : file_obj --> dict
json.loads(json_str) : json_str --> dict
json.dumps(dict) : dict --> json_str