Phép XOR(⊕) Cho hai số nguyên ? và ?, tính ?(?, ?), biết rằng ?(?, ?) = ? ⊕ (? + 1) ⊕ …⊕ +?. Dữ liệu: • Dòng đầu tiên ghi số nguyên T – số test case • Từ dòng thứ 2: Ghi hai số nguyên ?, ? Kết quả: • Gồm ? dòng, mỗi dòng in ra kết quả bài toán Giới hạn: • 1 ≤ ? ≤ 105 • 1 ≤ ? ≤ ? ≤ 1015 Ví dụ: Input Output 1 2 4 5 1 123 456 435

1 câu trả lời

uses crt; var n:integer;a,s:real; BEGIN clrscr; write('Nhap a: ');readln(a); repeat write('Nhap n: ');readln(n); until (n>0); if (n mod 2=0) and (a>=0) then begin s:=exp(1/n*ln(a)); writeln('Ket qua la: ',s:0:4); end else if (n mod 2<>0) then begin s:=exp(1/n*ln(abs(a))); writeln('Ket qua la: ',s:0:4); end else writeln('Khong xac dinh'); readln END.

Câu hỏi trong lớp Xem thêm