結果

問題 No.1224 I hate Sqrt Inequality
ユーザー root__786root__786
提出日時 2020-09-11 22:36:26
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,069 bytes
コンパイル時間 2,151 ms
コンパイル使用メモリ 206,640 KB
実行使用メモリ 21,504 KB
最終ジャッジ日時 2023-08-27 15:29:24
合計ジャッジ時間 5,812 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<map>
#include <bits/stdc++.h>
using namespace std;
#define int unsigned long long int
int printDecimal(int num,int den)
{
    map<int,int> m;
    string s="";
    int addbrackets=0,counter=2,storeCounter=2;
    int div=num/den;int mod=num%den;
    
    int storeDiv= div;
    int storeMod= mod*10;
    char t=storeDiv+'0';
    s=s+t+".";
    if(mod==0) {//cout<<div<<endl;
    return 0; }
    while(!m[mod])
    {
        m[mod]=counter;
        addbrackets=1;
        num=mod*10;
        div=num/den;mod=num%den;
        t=div+'0';
        s=s+t;counter++;
        if(mod==0)
        {
            addbrackets=0;
            break;
        }
    }
    int i=0,store=0;
    int ans=0;
    if(addbrackets==1)
    {
        counter=m[mod];
        for(int i=0;i<s.size();i++)
        {
            if(i==counter)// cout<<"(";
            //cout<<s[i];
            ans+=1;
        }
        //cout<<")";
    }
    return ans;
}
signed main() {
	
	int t,num,den;
	cin>>num>>den;
	if(printDecimal(num,den)>=1) cout<<"Yes";
    else cout<<"No";
}
0