var w,b:array[1..1000000] of longint;
n,a,m,i:longint;
S:qword;
procedure nhap;
begin
read(n,a,m);
end;
function lt(x,y:longint):int64;
var i:longint;
S:int64;
begin
S:=1;
for i:=1 to y do S:=S*x;
exit(S);
end;
procedure xuli;
var i:longint;
begin
for i:=1 to n do
w[i]:=lt(a,i) mod m + 1;
end;
procedure tong;
var i:longint;
begin
S:=0;
for i:=1 to n do S:=S+w[i];
write(S);
end;
begin
assign(input,'TAOMANG.inp');reset(input);
assign(output,'TAOMANG.out');rewrite(output);
nhap;
xuli;
tong;
end.
* Chuyên dạy lập trình ONLINE cho học sinh THCS, THPT *.
Mọi giao lưu, trao đổi, xin liên hệ: Lê Quang Vinh - zalo: 037.803.8755.
Page: Lớp học Code Sky
Group FB1: Ôn thi HSG9 - THTB - TS10 chuyên tin
Group FB2: Học Scratch - Ôn thi Tin học trẻ bảng A
Hiển thị các bài đăng có nhãn Mảng 1 chiều. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn Mảng 1 chiều. Hiển thị tất cả bài đăng
Chủ Nhật, 21 tháng 5, 2017
TAOMANG
TIMSO C++
#include <bits/stdc++.h>
using namespace std;
int n,a[1000005],d[1000005];
void nhap()
{
cin>>n;
for (int i=1;i<=n;i++)
cin>>a[i];
}
void qs(int l,int r)
{
//if(l>r) return
int i,j,x,t;
x=a[(l+r)/2];
i=l;j=r;
//cout<<i<<" "<<j<<endl;
while(i<=j)
{
while (a[i]<x) i++;
while (a[j]>x) j--;
//cout<<i<<" "<<j<<endl;
if (i<=j)
{
t=a[i];
a[i]=a[j];
a[j]=t;
i++;j--;
}
}
if (l<j) qs(l,j);
if (i<r) qs(i,r);
}
void xuli()
{
qs(1,n);
//sort(a+1,a+1+n); //dung ham sort cua c++
cout<<a[1]<<" "<<a[n]<<endl;
for (int i=1;i<=n-1;i++)
for(int j=a[i]+1;j<=a[i+1]-1;j++)
cout<<j<<" ";
}
int main()
{
ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// freopen("timso.inp","r",stdin);
// freopen("timso.out","w",stdout);
nhap();
xuli();
}
Chủ Nhật, 14 tháng 5, 2017
THOIGIAN Giải mã thời gian
Code
const fi='thoigian.inp'; fo='thoigian.out';
var
x,y:longint;
d:array[0..9]of byte=(4,2,2,2,3,2,3,2,4,3);
n:array[0..9]of byte=(2,0,3,3,1,3,3,1,3,3);
const fi='thoigian.inp'; fo='thoigian.out';
var
x,y:longint;
d:array[0..9]of byte=(4,2,2,2,3,2,3,2,4,3);
n:array[0..9]of byte=(2,0,3,3,1,3,3,1,3,3);
Đăng ký:
Nhận xét (Atom)