結果

問題 No.164 ちっちゃくないよ!!
ユーザー sujinbemani_79csujinbemani_79c
提出日時 2015-03-13 00:15:06
言語 C++11
(gcc 11.4.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 880 bytes
コンパイル時間 874 ms
コンパイル使用メモリ 69,168 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-21 15:21:33
合計ジャッジ時間 1,527 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 6 ms
6,940 KB
testcase_07 AC 4 ms
6,940 KB
testcase_08 AC 5 ms
6,940 KB
testcase_09 AC 5 ms
6,940 KB
testcase_10 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~

ソースコード

diff #

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<queue>
using namespace std;
int main(){
    int n,num;
    string V;
    long long int minans=9223372036854775807;
    scanf("%d",&n);
    for(int i=0;i<n;i++){
        cin>>V;
        for(int j=2;j<=36;j++){
            long long int nowans=0;
            for(int k=V.size()-1;0<=k;k--){
                if('0'<=V[k]&&V[k]<='9')num=V[k]-'0';
                else num=V[k]-'A'+10;

                //printf("[%d][%d][%d][%d]\n",j,k,V.size(),num);

                if(j-1<num){

                    //puts("");

                    break;
                }
                long long int a=pow(j,V.size()-(k+1));
                nowans+=(long long int)num*(long long int)a;

                if(k==0)minans=min(minans,nowans);
            }
        }
    }
    printf("%lld\n",minans);
    return 0;
}
0