結果

問題 No.791 うし数列
ユーザー kami_apkkami_apk
提出日時 2019-04-28 10:42:05
言語 C++11
(gcc 11.4.0)
結果
TLE  
実行時間 -
コード長 914 bytes
コンパイル時間 618 ms
コンパイル使用メモリ 67,556 KB
実行使用メモリ 10,624 KB
最終ジャッジ日時 2024-05-08 21:56:29
合計ジャッジ時間 3,891 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,624 KB
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<algorithm>
#include<iostream>
#include<stdio.h>
#include<string>
#include<vector>
#include <cmath>
#include <algorithm>
#include <functional>

using namespace std;
typedef long long ll;

int gcd(int m,int n)
{
	// 引数に0がある場合は0を返す
	if ( ( 0 == m ) || ( 0 == n ) )
		return 0;
	
	// ユークリッドの方法
	while( m != n )
	{
		if ( m > n ) m = m - n;
		else         n = n - m;
	}
	return m;
}//gcd



int main(){
    // input
    ll N;
    cin >>N;
    
    //vector<int> v(N);
    //std::sort(g.begin(),g.end());

    ll ans = 0;
    ll out = -1;
    int flag = 1;
    while(flag != 0){
        N = N-3;
        
        if(N % 10 == 0 && N >0){
            N = N /10;
            ans++;
        }

        if( N==1){
            flag =0;
            out = ans;
        }

        if(N<=0){
            out = -1;
        }


    }
    cout << out << endl;


    return 0;
}
0