May 2024 | Mon | Tue | Wed | Thu | Fri | Sat | Sun |
---|
| | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | | | Calendar |
|
Top posting users this week | |
| | Trần Ngọc Tuấn | |
| | |
Tác giả | Thông điệp |
---|
vũ văn xuânn
Tổng số bài gửi : 8 Join date : 13/09/2022
| Tiêu đề: Re: Trần Ngọc Tuấn Wed Sep 14, 2022 2:58 pm | |
| uses math; var a:array[-1..300,-1..300] of longint; n,i,j,s,m:longint; function tong(x,y,xl,yl:longint):longint; var s1:longint; begin for x:=1 to xl do for y:=1 to yl do s:=s+a[x,y]; tong:=s1; end; procedure sub1(); var x1,y1,k,p,tam:longint; begin p:=0; for k:=1 to min(n,m) do for x1:=1 to m do for y1:=1 to n do begin tam:=tong(x1,y1,x1+k-1,y1+k-1); if tam=s then begin writeln(x1,#32,y1,#32,k); p:=1; end; end; if p=0 then writeln(-1);
end; begin assign(input,'bai1111.inp'); reset(input); assign(output,'bai1111.out'); rewrite(output); readln(m,n,s); for i:=1 to m do for j:=1 to n do readln(a[i,j]); sub1(); close(input); close(output); end. | |
| | | dogsgaming123
Tổng số bài gửi : 34 Join date : 13/06/2022
| Tiêu đề: Re: Trần Ngọc Tuấn Tue Sep 20, 2022 9:26 pm | |
| DO THI DFS - Code:
-
#include <bits/stdc++.h> #define For(i,a,b) for(int i=a;i<=b;i++) #define ll long long #define nmax 100007 #define first F #define second S #define fast ios_base::sync_with_stdio(false);cin.tie(NULL);
using namespace std;
int c[nmax],d[nmax]; int fre[1007]; int a[307][307]; int n,u,v,m,k,k0;
void duyet(int i) { int j;
fre[i]=false; //k++;c[k]=I;
For(j,1,n) if (fre[j]==true && a[i][j]==1) duyet(j); }
int main() { fast freopen("baitapdothi1.inp","r",stdin); freopen("baitapdothi1.out","w",stdout); cin >> m >> n; For(i,1,m) { cin >> u >> v; a[u][v]=1; a[v][u]=1; } For(i,1,n) fre[i]=true;
int res=0;
For(i,1,n) if (fre[i]==true) { duyet(i); res++; // đưa mảng c, khởi tạo lại k // lưu c vào d, k vào k0
}
cout << res; return 0; }
| |
| | | dogsgaming123
Tổng số bài gửi : 34 Join date : 13/06/2022
| Tiêu đề: Re: Trần Ngọc Tuấn Mon Sep 26, 2022 8:13 pm | |
| WSORT-XAU - Code:
-
#include <bits/stdc++.h> #define nmax 100007
using namespace std;
string s,c[nmax],d[nmax],t1,t2; int k2,k1;
void nhap() { cin >> s; }
void xuli() { for(int i=0;i<s.size();i++) if (s[i]>='a' && s[i]<'z') { if (t2.size()>0) { k1++; d[k1]=t2; t2=""; } t1 = t1 + s[i]; } else { t1 = t1 + s[i]; if (t1.size()>0) { k2++; c[k2]=t1; t1=""; } } if (t1.size()>0) { k2++; c[k2]=t1; } if (t2.size()>0) { k1++; d[k1]=t1; } sort(c+1,c+k2+1); if (s[1]=='.') for(int i=1;i<=k2;i++) cout << d[i] << c[i]; else for(int i=1;i<=k2;i++) cout << c[i] << d[i]; }
int main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); freopen("WSORT.inp","r",stdin); freopen("WSORT.out","w",stdout); nhap(); xuli(); return 0; }
| |
| | | Sponsored content
| Tiêu đề: Re: Trần Ngọc Tuấn | |
| |
| | | | Trần Ngọc Tuấn | |
|
Similar topics | |
|
| Permissions in this forum: | Bạn không có quyền trả lời bài viết
| |
| |
| |