結果

問題 No.939 and or
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2019-12-03 06:00:09
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 54 ms / 2,000 ms
コード長 2,826 bytes
コンパイル時間 1,927 ms
コンパイル使用メモリ 66,160 KB
実行使用メモリ 22,952 KB
最終ジャッジ日時 2023-08-16 20:29:23
合計ジャッジ時間 4,898 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 52 ms
20,908 KB
testcase_01 AC 51 ms
18,712 KB
testcase_02 AC 52 ms
18,820 KB
testcase_03 AC 52 ms
20,664 KB
testcase_04 AC 54 ms
20,836 KB
testcase_05 AC 50 ms
20,716 KB
testcase_06 AC 52 ms
20,696 KB
testcase_07 AC 53 ms
22,892 KB
testcase_08 AC 54 ms
22,808 KB
testcase_09 AC 49 ms
20,676 KB
testcase_10 AC 51 ms
20,864 KB
testcase_11 AC 51 ms
20,768 KB
testcase_12 AC 52 ms
20,744 KB
testcase_13 AC 49 ms
20,872 KB
testcase_14 AC 51 ms
20,848 KB
testcase_15 AC 51 ms
22,952 KB
testcase_16 AC 51 ms
20,916 KB
testcase_17 AC 51 ms
20,956 KB
testcase_18 AC 54 ms
22,768 KB
testcase_19 AC 52 ms
20,804 KB
testcase_20 AC 50 ms
22,836 KB
testcase_21 AC 53 ms
20,816 KB
testcase_22 AC 49 ms
20,768 KB
testcase_23 AC 51 ms
20,864 KB
testcase_24 AC 51 ms
20,844 KB
testcase_25 AC 53 ms
20,864 KB
testcase_26 AC 52 ms
20,848 KB
testcase_27 AC 51 ms
20,756 KB
testcase_28 AC 53 ms
22,784 KB
testcase_29 AC 51 ms
20,804 KB
testcase_30 AC 51 ms
20,772 KB
testcase_31 AC 50 ms
20,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var s=sc.Ia;
		if(s[0]>s[1]){
			s[0]^=s[1];
			s[1]^=s[0];
			s[0]^=s[1];
		}
		if(s[0]==s[1]){
			Console.WriteLine(1);
			return;
		}
		if((s[0]&s[1])!=s[0]){
			Console.WriteLine(0);
			return;
		}
		Console.WriteLine("{0}",1L<<(bits(s[1]-s[0])-1));
	}
	static string Binary(long a,int b){
		string s=Convert.ToString(a,2);
		return (b>s.Length?new string('0',b-s.Length):"")+s;
	}
	static int bits(long bits){
		bits=(bits&0x55555555)+(bits>>1&0x55555555);
		bits=(bits&0x33333333)+(bits>>2&0x33333333);
		bits=(bits&0x0f0f0f0f)+(bits>>4&0x0f0f0f0f);
		bits=(bits&0x00ff00ff)+(bits>>8&0x00ff00ff);
		return (int)((bits&0x0000ffff)+(bits>>16&0x0000ffff));
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0