?
?
cin >> n>> m;
if(n % (m+1) == 0) printf("second\n");
else printf("first\n");
?
?
?
#include<iostream>
using namespace std;
int main(){
int n,a;
cin>>n;
for(int i=1;i<=n;i++) {
cin>>a;
if(a%6==0)cout<<"second"<<endl;
else cout<<"first"<<endl;
}
}
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
StreamTokenizer st=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
st.nextToken();
int n=(int)st.nval;
for(int i=0;i<n;i++) {
st.nextToken();
long m=(long)st.nval;
if(m%6==0) System.out.println("second");
else System.out.println("first");
}
}
}
T=int(input())
while T>0:
n=int(input())
if n%6 :
print("first")
else:
print("second")
T-=1
?
#include<bits/stdc++.h>
using namespace std;
int t;
int main(){
cin>>t;
while (t--){
int n;
scanf("%d",&n);
if (n%4==0) printf("second\n");//是4的倍数后取的胜
else printf("first\n");//否则先取的胜
}
return 0;
}
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n=sc.nextInt();
for(int i=0;i<n;i++){
if(sc.nextInt()%4==0) System.out.println("second"); else System.out.println("first");
}
}
}
n=int(input())
for i in range(n):
w=0
w=int(input())
if(w%4==0):
print("second")
else:
print("first")
?
?
?
#include<bits/stdc++.h>
#define N 1010
using namespace std;
int a[N],i;
int main()
{
cin>>a[1];
for(i=2;a[i-1]!=0;i++)cin>>a[i];
for(int j=1;j<i-1;j++){
if(a[j]%2==0)cout<<"Alice\n";
else cout<<"Bob\n";
}
return 0;
}
?
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;
public class Main {
public static void main(String[] args) throws IOException {
StreamTokenizer st=new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
for(;;) {
st.nextToken();
int m=(int)st.nval;
if(m==0)return;
if((m*m)%2==0) System.out.println("Alice");
else System.out.println("Bob");
}
}
}
while True:
a=int(input())
if a==0:
break
if a%2==0:
print("Alice")
else:
print("Bob")
?
?
?
?
?
?
?
#include<cstdio>
int main() {
int T;
scanf("%d", &T);
while(T--) {
int ans=0;
int n, k;
scanf("%d", &n);
for(int i = 0;i < n;i++) {
scanf("%d", &k);
ans^=k;
}
printf("%s\n", ans?"NO":"YES");
}
return 0;
}
import java.math.BigDecimal;
import java.math.BigInteger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;
public class Main{
static int dp[][]=new int[1<<12][145];
public static void main(String args[]){
Scanner scan=new Scanner(System.in);
int T=scan.nextInt();
for(int i=0;i<T;i++) {
int n=scan.nextInt();
int res=0;
for(int j=0;j<n;j++) {
res^=scan.nextInt();
}
if(res!=0) System.out.println("NO");
else System.out.println("YES");
}
}
}
T = int(input())
while T > 0:
n = int(input())
ans = 0
a = list(map(int, input().split()))
for i in range(n):
ans ^= a[i]
print('NO' if ans else 'YES', end = '\n')
T -= 1
?
?
?
?
#include<bits/stdc++.h>
using namespace std;
int main(){
int n, m;
double gold = (1 + sqrt(5))/2; //黄金分割=1.618033988749894…精确到小数15位
int T = 1;
cin >> T;
while(T --){
cin >> n >> m;
long long a = min(n, m), b = max(n, m);
double k = (double)(b - a);
long long test = (long long)(k*gold); //乘以黄金分割数,然后取整
if(test == a) cout << "YES" << endl; //先手败
else cout << "NO" << endl; //先手胜
}
return 0;
}
import java.io.*;
import java.util.*;
public class Main {
public static void main(String[] args) throws IOException{
Scanner st = new Scanner(System.in);
int T = st.nextInt();
while(T -- != 0){
int n = st.nextInt();
int m = st.nextInt();
int a = Math.min(n , m);
int b = Math.max(n , m);
int x = Math.abs(a-b);
double y = (Math.sqrt(5)+1)/2;
if(Math.min(a,b) == (int)(y*x)){
System.out.println("YES");
}
else{
System.out.println("NO");
}
}
}
}
t = int(input())
for i in range(1 , t + 1):
a,b = map(int,input().split())
c = ((5**(0.5)) + 1) / 2
if a > b:
a,b = b,a
if int((b-a)*c) == a:
print("YES")
else:
print("NO")
?
|