LeetCode Weekly Contest 171 1問目 - Convert Integer to the Sum of Two No-Zero Integers [1317]

Source

LeetCode Weekly Contest 171
問題文

問題概要

省略

解法

省略

cLayversion 20200119-1)のコード

C++に変換後のコードはこちら

#define main dummy_main
{}
#undef main

int ok(int n){
  while(n){
    if(n%10==0) return 0;
    n /= 10;
  }
  return 1;
}

class Solution {
public:
  vector<int> getNoZeroIntegers(int n) {
    rep(i,1,n) if(ok(i) && ok(n-i)) break;
    return vector<int>{i, n-i};
  }
};

Current time: 2024年03月29日16時06分12秒
Last modified: 2020年01月25日23時02分56秒 (by laycrs)
Tags: Competitive_Programming_Incomplete LeetCode
トップページに戻る

Logged in as: unknown user (not login)

ログイン: