提出 #15619615


ソースコード 拡げる

// Hail god Yato
 
#include <bits/stdc++.h> 
using namespace std;
 
#define hs ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
const ll mod = 1000000007;
const ll INF = 1e18;
const ll MAX = 100001;
//
//
                void solve(){
                    ll n;
                    cin>>n;
                    if(n%2 == 0){
                        cout<<"-1";
                        return ;
                    }
                    ll k = 7;
                    ll cnt = 1;
                    while(true){
                        if(k%n == 0){
                            cout<<cnt;
                            break;
                        }
                        if(cnt > n){
                            cout<<"-1";
                            break;
                        }
                        k = (k%n)*10 +7;
                        // cout<<k<<"\n";
                        ++cnt;
                    }
                }
                int main(){ 
                        hs;
                        ll t;
                        t=1;
                        // cin>>t;
                        for (int i=1; i<=t; i++){
                                //cout<<"Case #"<<i<<": ";
                                solve();
                         }
        return 0; 
}         
 
 

提出情報

提出日時
問題 C - Repsept
ユーザ shivam51
言語 C++ (GCC 9.2.1)
得点 300
コード長 1370 Byte
結果 AC
実行時間 24 ms
メモリ 3648 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 300 / 300
結果
AC × 3
AC × 27
セット名 テストケース
Sample sample_01.txt, sample_02.txt, sample_03.txt
All hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, sample_01.txt, sample_02.txt, sample_03.txt
ケース名 結果 実行時間 メモリ
hand_01.txt AC 6 ms 3568 KiB
hand_02.txt AC 2 ms 3492 KiB
hand_03.txt AC 2 ms 3620 KiB
hand_04.txt AC 4 ms 3532 KiB
hand_05.txt AC 23 ms 3604 KiB
hand_06.txt AC 24 ms 3492 KiB
hand_07.txt AC 2 ms 3528 KiB
hand_08.txt AC 2 ms 3516 KiB
hand_09.txt AC 12 ms 3580 KiB
hand_10.txt AC 5 ms 3524 KiB
hand_11.txt AC 5 ms 3544 KiB
hand_12.txt AC 2 ms 3532 KiB
hand_13.txt AC 4 ms 3548 KiB
hand_14.txt AC 2 ms 3616 KiB
random_01.txt AC 2 ms 3472 KiB
random_02.txt AC 4 ms 3520 KiB
random_03.txt AC 24 ms 3528 KiB
random_04.txt AC 11 ms 3528 KiB
random_05.txt AC 2 ms 3488 KiB
random_06.txt AC 2 ms 3588 KiB
random_07.txt AC 2 ms 3544 KiB
random_08.txt AC 4 ms 3604 KiB
random_09.txt AC 11 ms 3584 KiB
random_10.txt AC 5 ms 3544 KiB
sample_01.txt AC 2 ms 3528 KiB
sample_02.txt AC 2 ms 3648 KiB
sample_03.txt AC 20 ms 3584 KiB