Editorial for 第2回卬高杯 B問題 - Hiyoko Checker


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

Author: admin

Python

Python3

a,i=int(input()),0
while 3**i<a:i+=1
print(i)

C++

C++20

#include <bits/stdc++.h>
using namespace std;

int main(){
    int N;
    cin >> N;
    int i = 0, k = 1;
    while (k < N){
        i++;
        k *= 3;
    }
    cout << i << endl;
}

Comments

There are no comments at the moment.