Submission #2107133


Source Code Expand

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

int N;
int S,T;

int main()
{
    scanf("%d",&N);
    scanf("%d%d",&S,&T);
    int ans = 0;
    while(1)
    {
        if(T == 1)
        {
            if(S == 1)printf("%d\n",ans);
            else printf("-1\n");
            return 0;
        }
        if(T == S)
        {
            printf("%d\n",ans);
            return 0;
        }
        T = T / 2;
        ans++;
    }
    printf("-1\n");
    return 0;
}

Submission Info

Submission Time
Task B - Camphor Tree
User unit
Language C++14 (GCC 5.4.1)
Score 100
Code Size 492 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:9:19: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&N);
                   ^
./Main.cpp:10:24: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d",&S,&T);
                        ^

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 13
Set Name Test Cases
All 00_sample, 01_sample, 02_sample, max_01, max_02, max_03, max_04, max_05, max_06, max_07, max_08, max_09, min_00
Case Name Status Exec Time Memory
00_sample AC 1 ms 256 KB
01_sample AC 1 ms 256 KB
02_sample AC 1 ms 256 KB
max_01 AC 1 ms 256 KB
max_02 AC 1 ms 256 KB
max_03 AC 1 ms 256 KB
max_04 AC 1 ms 256 KB
max_05 AC 1 ms 256 KB
max_06 AC 1 ms 256 KB
max_07 AC 1 ms 256 KB
max_08 AC 1 ms 256 KB
max_09 AC 1 ms 256 KB
min_00 AC 1 ms 256 KB