0埋め12桁の場合
- 型がlong longならlldと書く
printf("%012lld\n", ans);
使った問題
coutは?→ちょっと面倒
- https://marycore.jp/prog/cpp/padding-left-right-zero/
- AC https://atcoder.jp/contests/abc258/submissions/32945318
int main(){ cin.tie(0); ios::sync_with_stdio(false); // input ll k;cin>>k; ll h = 21 + k/60; ll m = k%60; // デフォルトでは ' ' で詰める cout << setfill('0'); // デフォルトで数値を右に詰める(std::right) cout<<std::right; cout << setw(2) << h << ":"; cout << setw(2) << m << "\n"; return 0; }