第一道递归做的,30%,不知啥原因,有大佬解答一下吗,是因为太大的数存不下?
#include<iostream> using namespace std; int solution(int x,int y){ if(x < y){ int temp = y; y = x; x = temp; } if(y == 0) return 0; if(x%y == 0) return y; return solution(y,x%y); } int main() { int a,b; cin>>a; cin>>b; cout<<solution(a,b)<<endl; }