Submission #486072


Source Code Expand

Copy
#include<cstdio>
#include<cmath>
#include<algorithm>

using namespace std;

int L;
int s;

int gcd(int a,int b){
	if(a<b) return gcd(b,a);
	if(b==0) return a;
	return gcd(b,a%b);
}

int solve(){
	int res=0;
	for(int c=1;c<=L/2;c++){
		for(int b=1;b<=c;b++){
			int a2=c*c-b*b-s*s;
			if(a2<=0) continue;
			int a_=sqrt(a2);
			for(int a=max(0,a_-1);a<=min(b,a_+1);a++){
				if(a*a!=a2) continue;
				if(a+b<=c) continue;
//				printf("%d %d %d\n",a,b,c);
				int d=gcd(a,b);
				d=gcd(c,d);
				if(d!=1) continue;
				res++;
			}
		}
	}
	return res;
}

int main(){
	scanf("%d%d",&L,&s);
	if(L>10000) return 0;
	int ans=solve();
	printf("%d\n",ans);
	return 0;
}

Submission Info

Submission Time
Task D - ほぼピタゴラスの三角形
User wo01
Language C++ (GCC 4.9.2)
Score 0
Code Size 705 Byte
Status
Exec Time 187 ms
Memory 800 KB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:38:21: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&L,&s);
                     ^

Test Cases

Set Name Score / Max Score Test Cases
small 0 / 60 00_example_1.txt, 00_example_2.txt, 03_small_00.txt, 03_small_01.txt, 03_small_02.txt, 03_small_03.txt, 03_small_04.txt, 03_small_05.txt, 03_small_06.txt, 03_small_07.txt, 03_small_08.txt, 03_small_09.txt, 03_small_10.txt, 03_small_11.txt, 03_small_12.txt, 03_small_13.txt, 03_small_14.txt, 03_small_15.txt, 03_small_16.txt, 03_small_17.txt, 03_small_18.txt, 03_small_19.txt, 03_small_20.txt, 03_small_21.txt, 03_small_22.txt, 03_small_23.txt, 03_small_24.txt, 03_small_25.txt, 03_small_26.txt, 03_small_27.txt, 03_small_28.txt, 03_small_29.txt, 03_small_30.txt, 03_small_31.txt, 03_small_32.txt, 03_small_33.txt, 03_small_34.txt, 03_small_35.txt, 03_small_36.txt, 03_small_37.txt, 03_small_38.txt, 03_small_39.txt, 03_small_40.txt, 03_small_41.txt, 03_small_42.txt, 03_small_43.txt, 03_small_44.txt, 03_small_45.txt, 03_small_46.txt, 03_small_47.txt, 03_small_48.txt, 03_small_49.txt, 03_small_50.txt, 03_small_51.txt, 03_small_52.txt, 03_small_53.txt, 03_small_54.txt, 03_small_55.txt, 03_small_56.txt, 03_small_57.txt, 03_small_58.txt, 03_small_59.txt, 03_small_60.txt, 03_small_61.txt, 03_small_62.txt, 03_small_63.txt, 03_small_64.txt, 03_small_65.txt, 03_small_66.txt, 03_small_67.txt, 03_small_68.txt, 03_small_69.txt, 03_small_70.txt, 03_small_71.txt, 03_small_72.txt, 03_small_73.txt, 03_small_74.txt, 03_small_75.txt, 03_small_76.txt, 03_small_77.txt, 03_small_78.txt, 03_small_79.txt, 03_small_80.txt, 03_small_81.txt, 03_small_82.txt, 03_small_83.txt, 03_small_84.txt, 03_small_85.txt, 03_small_86.txt, 03_small_87.txt, 03_small_88.txt, 03_small_89.txt, 03_small_90.txt, 03_small_91.txt, 03_small_92.txt, 03_small_93.txt, 03_small_94.txt, 03_small_95.txt, 03_small_96.txt, 03_small_97.txt, 03_small_98.txt, 03_small_99.txt, 05_small_random_1.txt, 05_small_random_10.txt, 05_small_random_11.txt, 05_small_random_12.txt, 05_small_random_13.txt, 05_small_random_14.txt, 05_small_random_15.txt, 05_small_random_16.txt, 05_small_random_17.txt, 05_small_random_18.txt, 05_small_random_19.txt, 05_small_random_2.txt, 05_small_random_20.txt, 05_small_random_21.txt, 05_small_random_22.txt, 05_small_random_23.txt, 05_small_random_24.txt, 05_small_random_25.txt, 05_small_random_26.txt, 05_small_random_27.txt, 05_small_random_28.txt, 05_small_random_29.txt, 05_small_random_3.txt, 05_small_random_30.txt, 05_small_random_4.txt, 05_small_random_5.txt, 05_small_random_6.txt, 05_small_random_7.txt, 05_small_random_8.txt, 05_small_random_9.txt, 08_manual_0.txt, 08_manual_2.txt, 08_manual_3.txt
All 0 / 140 00_example_1.txt, 00_example_2.txt, 03_small_00.txt, 03_small_01.txt, 03_small_02.txt, 03_small_03.txt, 03_small_04.txt, 03_small_05.txt, 03_small_06.txt, 03_small_07.txt, 03_small_08.txt, 03_small_09.txt, 03_small_10.txt, 03_small_11.txt, 03_small_12.txt, 03_small_13.txt, 03_small_14.txt, 03_small_15.txt, 03_small_16.txt, 03_small_17.txt, 03_small_18.txt, 03_small_19.txt, 03_small_20.txt, 03_small_21.txt, 03_small_22.txt, 03_small_23.txt, 03_small_24.txt, 03_small_25.txt, 03_small_26.txt, 03_small_27.txt, 03_small_28.txt, 03_small_29.txt, 03_small_30.txt, 03_small_31.txt, 03_small_32.txt, 03_small_33.txt, 03_small_34.txt, 03_small_35.txt, 03_small_36.txt, 03_small_37.txt, 03_small_38.txt, 03_small_39.txt, 03_small_40.txt, 03_small_41.txt, 03_small_42.txt, 03_small_43.txt, 03_small_44.txt, 03_small_45.txt, 03_small_46.txt, 03_small_47.txt, 03_small_48.txt, 03_small_49.txt, 03_small_50.txt, 03_small_51.txt, 03_small_52.txt, 03_small_53.txt, 03_small_54.txt, 03_small_55.txt, 03_small_56.txt, 03_small_57.txt, 03_small_58.txt, 03_small_59.txt, 03_small_60.txt, 03_small_61.txt, 03_small_62.txt, 03_small_63.txt, 03_small_64.txt, 03_small_65.txt, 03_small_66.txt, 03_small_67.txt, 03_small_68.txt, 03_small_69.txt, 03_small_70.txt, 03_small_71.txt, 03_small_72.txt, 03_small_73.txt, 03_small_74.txt, 03_small_75.txt, 03_small_76.txt, 03_small_77.txt, 03_small_78.txt, 03_small_79.txt, 03_small_80.txt, 03_small_81.txt, 03_small_82.txt, 03_small_83.txt, 03_small_84.txt, 03_small_85.txt, 03_small_86.txt, 03_small_87.txt, 03_small_88.txt, 03_small_89.txt, 03_small_90.txt, 03_small_91.txt, 03_small_92.txt, 03_small_93.txt, 03_small_94.txt, 03_small_95.txt, 03_small_96.txt, 03_small_97.txt, 03_small_98.txt, 03_small_99.txt, 05_small_random_1.txt, 05_small_random_10.txt, 05_small_random_11.txt, 05_small_random_12.txt, 05_small_random_13.txt, 05_small_random_14.txt, 05_small_random_15.txt, 05_small_random_16.txt, 05_small_random_17.txt, 05_small_random_18.txt, 05_small_random_19.txt, 05_small_random_2.txt, 05_small_random_20.txt, 05_small_random_21.txt, 05_small_random_22.txt, 05_small_random_23.txt, 05_small_random_24.txt, 05_small_random_25.txt, 05_small_random_26.txt, 05_small_random_27.txt, 05_small_random_28.txt, 05_small_random_29.txt, 05_small_random_3.txt, 05_small_random_30.txt, 05_small_random_4.txt, 05_small_random_5.txt, 05_small_random_6.txt, 05_small_random_7.txt, 05_small_random_8.txt, 05_small_random_9.txt, 08_manual_0.txt, 08_manual_2.txt, 08_manual_3.txt, 10_max_01.txt, 10_max_02.txt, 10_max_03.txt, 10_max_04.txt, 10_max_05.txt, 10_max_06.txt, 10_max_07.txt, 10_max_08.txt, 10_max_09.txt, 10_max_10.txt, 10_max_41.txt, 10_max_42.txt, 10_max_43.txt, 10_max_44.txt, 10_max_45.txt, 10_max_46.txt, 10_max_47.txt, 10_max_48.txt, 10_max_49.txt, 10_max_50.txt, 11_large_00.txt, 11_large_01.txt, 11_large_02.txt, 11_large_03.txt, 11_large_04.txt, 11_large_05.txt, 11_large_06.txt, 11_large_07.txt, 11_large_08.txt, 11_large_09.txt, 20_manual_1.txt, 20_manual_10.txt, 20_manual_11.txt, 20_manual_12.txt, 20_manual_13.txt, 20_manual_4.txt, 20_manual_5.txt, 20_manual_6.txt, 20_manual_7.txt, 20_manual_8.txt, 20_manual_9.txt
Case Name Status Exec Time Memory
00_example_1.txt 27 ms 796 KB
00_example_2.txt 26 ms 792 KB
03_small_00.txt 26 ms 700 KB
03_small_01.txt 24 ms 796 KB
03_small_02.txt 27 ms 668 KB
03_small_03.txt 24 ms 732 KB
03_small_04.txt 24 ms 696 KB
03_small_05.txt 27 ms 800 KB
03_small_06.txt 23 ms 696 KB
03_small_07.txt 25 ms 668 KB
03_small_08.txt 27 ms 792 KB
03_small_09.txt 25 ms 796 KB
03_small_10.txt 25 ms 792 KB
03_small_11.txt 26 ms 800 KB
03_small_12.txt 25 ms 792 KB
03_small_13.txt 27 ms 800 KB
03_small_14.txt 27 ms 668 KB
03_small_15.txt 25 ms 792 KB
03_small_16.txt 25 ms 792 KB
03_small_17.txt 27 ms 692 KB
03_small_18.txt 25 ms 700 KB
03_small_19.txt 26 ms 800 KB
03_small_20.txt 26 ms 796 KB
03_small_21.txt 26 ms 692 KB
03_small_22.txt 24 ms 672 KB
03_small_23.txt 25 ms 800 KB
03_small_24.txt 25 ms 796 KB
03_small_25.txt 26 ms 796 KB
03_small_26.txt 24 ms 788 KB
03_small_27.txt 27 ms 796 KB
03_small_28.txt 26 ms 700 KB
03_small_29.txt 23 ms 696 KB
03_small_30.txt 25 ms 692 KB
03_small_31.txt 24 ms 688 KB
03_small_32.txt 23 ms 700 KB
03_small_33.txt 26 ms 700 KB
03_small_34.txt 25 ms 800 KB
03_small_35.txt 27 ms 792 KB
03_small_36.txt 24 ms 796 KB
03_small_37.txt 27 ms 792 KB
03_small_38.txt 24 ms 692 KB
03_small_39.txt 26 ms 692 KB
03_small_40.txt 25 ms 800 KB
03_small_41.txt 25 ms 800 KB
03_small_42.txt 26 ms 792 KB
03_small_43.txt 25 ms 800 KB
03_small_44.txt 25 ms 672 KB
03_small_45.txt 26 ms 796 KB
03_small_46.txt 26 ms 796 KB
03_small_47.txt 25 ms 800 KB
03_small_48.txt 26 ms 792 KB
03_small_49.txt 26 ms 796 KB
03_small_50.txt 24 ms 796 KB
03_small_51.txt 27 ms 792 KB
03_small_52.txt 26 ms 696 KB
03_small_53.txt 25 ms 796 KB
03_small_54.txt 24 ms 800 KB
03_small_55.txt 25 ms 796 KB
03_small_56.txt 23 ms 700 KB
03_small_57.txt 26 ms 696 KB
03_small_58.txt 24 ms 796 KB
03_small_59.txt 25 ms 796 KB
03_small_60.txt 26 ms 792 KB
03_small_61.txt 27 ms 784 KB
03_small_62.txt 25 ms 792 KB
03_small_63.txt 24 ms 800 KB
03_small_64.txt 25 ms 800 KB
03_small_65.txt 25 ms 800 KB
03_small_66.txt 25 ms 688 KB
03_small_67.txt 26 ms 796 KB
03_small_68.txt 24 ms 652 KB
03_small_69.txt 25 ms 800 KB
03_small_70.txt 24 ms 796 KB
03_small_71.txt 26 ms 792 KB
03_small_72.txt 23 ms 796 KB
03_small_73.txt 28 ms 760 KB
03_small_74.txt 25 ms 692 KB
03_small_75.txt 25 ms 700 KB
03_small_76.txt 26 ms 796 KB
03_small_77.txt 26 ms 800 KB
03_small_78.txt 26 ms 692 KB
03_small_79.txt 25 ms 796 KB
03_small_80.txt 26 ms 688 KB
03_small_81.txt 24 ms 796 KB
03_small_82.txt 26 ms 668 KB
03_small_83.txt 23 ms 696 KB
03_small_84.txt 25 ms 796 KB
03_small_85.txt 27 ms 800 KB
03_small_86.txt 27 ms 696 KB
03_small_87.txt 26 ms 796 KB
03_small_88.txt 25 ms 792 KB
03_small_89.txt 24 ms 700 KB
03_small_90.txt 26 ms 696 KB
03_small_91.txt 27 ms 696 KB
03_small_92.txt 25 ms 672 KB
03_small_93.txt 26 ms 700 KB
03_small_94.txt 24 ms 696 KB
03_small_95.txt 26 ms 700 KB
03_small_96.txt 25 ms 792 KB
03_small_97.txt 25 ms 672 KB
03_small_98.txt 27 ms 800 KB
03_small_99.txt 25 ms 800 KB
05_small_random_1.txt 31 ms 696 KB
05_small_random_10.txt 31 ms 700 KB
05_small_random_11.txt 34 ms 796 KB
05_small_random_12.txt 184 ms 652 KB
05_small_random_13.txt 54 ms 692 KB
05_small_random_14.txt 109 ms 796 KB
05_small_random_15.txt 92 ms 796 KB
05_small_random_16.txt 135 ms 796 KB
05_small_random_17.txt 162 ms 772 KB
05_small_random_18.txt 100 ms 668 KB
05_small_random_19.txt 99 ms 796 KB
05_small_random_2.txt 27 ms 792 KB
05_small_random_20.txt 35 ms 776 KB
05_small_random_21.txt 183 ms 800 KB
05_small_random_22.txt 154 ms 740 KB
05_small_random_23.txt 65 ms 796 KB
05_small_random_24.txt 94 ms 796 KB
05_small_random_25.txt 106 ms 700 KB
05_small_random_26.txt 37 ms 652 KB
05_small_random_27.txt 25 ms 748 KB
05_small_random_28.txt 76 ms 796 KB
05_small_random_29.txt 146 ms 796 KB
05_small_random_3.txt 69 ms 668 KB
05_small_random_30.txt 61 ms 792 KB
05_small_random_4.txt 167 ms 672 KB
05_small_random_5.txt 82 ms 712 KB
05_small_random_6.txt 45 ms 796 KB
05_small_random_7.txt 39 ms 792 KB
05_small_random_8.txt 104 ms 672 KB
05_small_random_9.txt 86 ms 796 KB
08_manual_0.txt 186 ms 672 KB
08_manual_2.txt 27 ms 696 KB
08_manual_3.txt 187 ms 796 KB
10_max_01.txt 23 ms 796 KB
10_max_02.txt 23 ms 704 KB
10_max_03.txt 25 ms 796 KB
10_max_04.txt 26 ms 796 KB
10_max_05.txt 26 ms 800 KB
10_max_06.txt 23 ms 700 KB
10_max_07.txt 26 ms 796 KB
10_max_08.txt 24 ms 700 KB
10_max_09.txt 25 ms 792 KB
10_max_10.txt 25 ms 784 KB
10_max_41.txt 25 ms 796 KB
10_max_42.txt 28 ms 792 KB
10_max_43.txt 26 ms 792 KB
10_max_44.txt 24 ms 800 KB
10_max_45.txt 24 ms 796 KB
10_max_46.txt 24 ms 792 KB
10_max_47.txt 26 ms 796 KB
10_max_48.txt 24 ms 692 KB
10_max_49.txt 25 ms 792 KB
10_max_50.txt 26 ms 792 KB
11_large_00.txt 25 ms 696 KB
11_large_01.txt 23 ms 800 KB
11_large_02.txt 24 ms 800 KB
11_large_03.txt 25 ms 792 KB
11_large_04.txt 25 ms 696 KB
11_large_05.txt 24 ms 648 KB
11_large_06.txt 23 ms 796 KB
11_large_07.txt 23 ms 700 KB
11_large_08.txt 24 ms 700 KB
11_large_09.txt 25 ms 792 KB
20_manual_1.txt 25 ms 792 KB
20_manual_10.txt 25 ms 788 KB
20_manual_11.txt 26 ms 732 KB
20_manual_12.txt 26 ms 668 KB
20_manual_13.txt 25 ms 700 KB
20_manual_4.txt 23 ms 800 KB
20_manual_5.txt 26 ms 796 KB
20_manual_6.txt 25 ms 696 KB
20_manual_7.txt 24 ms 800 KB
20_manual_8.txt 24 ms 792 KB
20_manual_9.txt 25 ms 672 KB