Rank Tên đăng nhập Điểm Bài tập ▾ Giới thiệu
20501 101 1
20502
or_and_xor_bd_2k9
Trần Đỗ Thái Sơn
201 1
20502 201 1
20504 101 1
20504 101 1
20506 201 1
20507 101 1
20508 842 1
20509 101 1
20509 101 1
20511 301 1
20512 667 1
20513 101 1
20514 90 1
20515
cheems
cheems mc
101 1
20516 201 1
20517 801 1

code

20518 1001 1
20519 301 1
20520 101 1
20521 301 1
20522 101 1
20522 101 1
20524 255 1
20525 1301 1
20526 301 1
20527 425 1
20528 114 1
20529 301 1
20529 301 1
20529 301 1
20532 101 1
20533 301 1
20534 201 1
20535 101 1
20536 16 1
20537 1201 1
20538 301 1
20539 1601 1
20540 1501 1
20541 1401 1
20542
ninjasaochep
Bùi Anh Tài
201 1
20543 1301 1
20543 1301 1
20543 1301 1
20546 650 1
20547 1301 1

include<bits/stdc++.h>

define ll long long

define f(i,a,b) for(ll i=a;i<=b;i++)

define fd(i,a,b) for(ll i=a;i>=b;i--)

using namespace std;
ll n,q,x,y;
ll a[10000006],b[10000004],t[10000009];
void doc()
{
cin>>n>>q;
t[0]=0;
f(i,1,n)
{
cin>>a[i];
t[i]=t[i-1]+a[i];
}
}
void xuly()
{
while(q--)
{
cin>>x>>y;
cout<<t[y]-t[x-1]<<endl;
}
}
int main()
{
doc();
xuly();
return 0;
}

20548 401 1
20549 101 1
20550 201 1
20550 201 1
20550 201 1
20550 201 1
20550 201 1
20550 201 1

include <bits/stdc++.h>

using namespace std;

define ll long long

define endl "\n"

int main(){
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n, x; cin >> n >> x;
int a[n];
for(int i=0; i<n; i++) cin >> a[i];
int i, j; i = 0;
j = n-1;
int check = 0;
while(i < j){
if(a[i] + a[j] == x){
cout << i+1 << " " << j+1;
check = 1;
break;
}
else if(a[i] + a[j] > x){
j--;
}
else if(a[i] + a[j] < x){
i++;
}
}
if(check == 0) cout << "No solution";
}

20556 801 1
20557 75 1
20558 801 1
20558 801 1
20560 10 1
20561 101 1
20562 901 1
20563 1301 1
20564 101 1
20564 101 1
20564 101 1
20567 889 1
20568 101 1
20569 201 1
20569 201 1
20571 101 1
20572 201 1
20573 801 1
20574 201 1
20575 801 1
20576 20 1
20577 476 1
20578 101 1
20579 1701 1
20580 336 1
20581 201 1

tap code de sau nay di thi

20582 101 1
20582 101 1
20582 101 1
20585 45 1
20586 1001 1
20587 201 1
20588 301 1
20589 101 1
20590 743 1
20591 160 1
20592 101 1
20593 40 1
20594 401 1
20595 1701 1
20596 101 1
20597 640 1
20598 1201 1
20599 101 1
20600 200 1