結果

問題 No.1224 I hate Sqrt Inequality
ユーザー root__786root__786
提出日時 2020-09-11 22:35:28
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,006 bytes
コンパイル時間 822 ms
コンパイル使用メモリ 83,916 KB
実行使用メモリ 4,500 KB
最終ジャッジ日時 2023-08-27 15:28:01
合計ジャッジ時間 1,962 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include<map>
using namespace std;
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;
}
int main() {
	
	int t,num,den;
	cin>>num>>den;
	if(printDecimal(num,den)>=1) cout<<"Yes";
    else cout<<"No";
}
0