B Breaking Branches
The meaning of problems: broken branches race two people, who left the last one, that is, unable to break out of integer output
Idea: branch length n, if odd, Bob wins, if even, then Alice won, and need to output 1;
1 #include<stdio.h> 2 int main(){ 3 int n; 4 scanf("%d",&n); 5 if(n%2==0){ 6 printf("Alice\n"); 7 printf("1\n"); 8 }else{ 9 printf("Bob"); 10 } 11 }
J Jazz it Up!
The meaning of problems: the input is a number a, the output of a number b, so that the result can not be a * b apart from any number of squares
Ideas: the test cycle to
1 #include<iostream> 2 #include<cmath> 3 #include<cstring> 4 using namespace std; 5 int main(){ 6 long long int m,n,sum,t,flag=0; 7 scanf("%lld",&n); 8 for(long long int i=2;i<=n-1;i++){ 9 sum=n*i; 10 t=sqrt(sum); 11 for(long long int j=2;j<=t;j++){ 12 if(sum%(j*j)==0){ 13 flag=1; 14 break; 15 } 16 } 17 if(flag==1){ 18 flag=0; 19 continue; 20 }else{ 21 printf("%lld",i); 22 break; 23 } 24 } 25 }