結果

問題 No.791 うし数列
ユーザー kami_apkkami_apk
提出日時 2019-04-28 10:34:28
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 966 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 67,452 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-05-08 21:27:12
合計ジャッジ時間 1,443 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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++;
        }else {
            flag = 0;
            if(ans >0){
                out = ans;
            }
        }

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


    }
    cout << out << endl;


    return 0;
}
0