April 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 | | | | | | Calendar |
|
Top posting users this week | |
| | Nguyễn Nhật Quân | |
| | |
Tác giả | Thông điệp |
---|
quanttk33
Tổng số bài gửi : 60 Join date : 23/06/2022 Age : 16 Đến từ : Vietnam
| Tiêu đề: Re: Nguyễn Nhật Quân Sat Sep 03, 2022 8:49 pm | |
| - Code:
-
//Code by QunHaker :3 //QLPTS #include <iostream> #include <cstring> #define nmax 1000007 #define start 1 #define fre freopen #define f(i,a,b) for(int i=a;i<=b;i++) #define fd(i,a,b) for(int i=a;i>=b;i--)
using namespace std;
int n, a[nmax], t[nmax];
void xuli(int i){ f(j,1,i){ cout<<a[j]<<" "; } cout<<endl; }
void thu(int i){ for(int j=a[i-1]; j*2<=n-t[i-1]; j++){ a[i]=j; t[i]=t[i-1]+j; thu(i+1); } a[i]=n-t[i-1]; xuli(i); }
int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); fre("QLPTS.inp","r",stdin); fre("QLPTS.out","w",stdout); memset(a,sizeof(a),0); t[0]=0; a[0]=1; cin>>n; thu(start); return 0; }
| |
| | | quanttk33
Tổng số bài gửi : 60 Join date : 23/06/2022 Age : 16 Đến từ : Vietnam
| Tiêu đề: Re: Nguyễn Nhật Quân Sun Sep 04, 2022 7:39 pm | |
| - Code:
-
//Code by QunHaker :3 //QLPTSPR #include <bits/stdc++.h> #include <iostream> #include <cstring> #define start 1 #define ll long long #define fre freopen #define nmax 1000007 #define f(i,a,b) for(int i=a;i<=b;i++) using namespace std; int n, a[nmax], f[nmax], t[nmax]; vector <int> vtr; map <int, bool> mp; void sangnt(int u) { memset(f,sizeof(f),0); for(int i=1; i<=u; i++){ f[i]=1; f[1]=0; for(int i=2; i*i<=u; i++) if(f[i]==1) for(int j=i; j*i<=u; j++) f[i*j]=0; } } void xuli(int i){ int p=0, p1=0; f(j,1,i){ if(f[a[j]]!=1){ p=1; break; } } f(j,1,i){ if(a[j]==a[j+1]){ p1=1; break; http://vtr.push_back(a[j]); } } if(p1==0&p==0){ f(j,1,i){ cout<<a[j]<<" "; } cout<<endl; } } /* void add_push(){ for(auto i: n){ cout<<i<<" "; } } */ void thu(int i){ for(int j=a[i-1]; j*2<=n-t[i-1]; j++){ a[i]=j; t[i]=t[i-1]+j; thu(i+1); } a[i]=n-t[i-1]; xuli(i); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); fre("QLPTSPR.inp","r",stdin); fre("QLPTSPR.out","w",stdout); memset(a,sizeof(a),0); memset(t,sizeof(t),0); cin>>n; sangnt(n); t[0]=0; a[0]=1; thu(start); return 0; } | |
| | | quanttk33
Tổng số bài gửi : 60 Join date : 23/06/2022 Age : 16 Đến từ : Vietnam
| Tiêu đề: Re: Nguyễn Nhật Quân Sun Sep 04, 2022 7:41 pm | |
| - Code:
-
//Code by QunHaker :3 //QLPTSPR #include <bits/stdc++.h> #include <iostream> #include <cstring> #define start 1 #define ll long long #define fre freopen #define nmax 1000007 #define f(i,a,b) for(int i=a;i<=b;i++) using namespace std; int n, a[nmax], f[nmax], t[nmax]; vector <int> vtr; map <int, bool> mp; void sangnt(int u) { memset(f,sizeof(f),0); for(int i=1; i<=u; i++){ f[i]=1; f[1]=0; for(int i=2; i*i<=u; i++) if(f[i]==1) for(int j=i; j*i<=u; j++) f[i*j]=0; } } void xuli(int i){ int p=0, p1=0; f(j,1,i){ if(f[a[j]]!=1){ p=1; break; } } f(j,1,i){ if(a[j]==a[j+1]){ p1=1; break; http://vtr.push_back(a[j]); } } if(res<i){ res=i; f(j,1,i) c[i]=a[i]; } if(p1==0&p==0){ f(j,1,i){ cout<<a[j]<<" "; } cout<<endl; } } /* void add_push(){ for(auto i: n){ cout<<i<<" "; } } */ void thu(int i){ for(int j=a[i-1]; j*2<=n-t[i-1]; j++){ a[i]=j; t[i]=t[i-1]+j; thu(i+1); } a[i]=n-t[i-1]; xuli(i); } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); fre("QLPTSPR.inp","r",stdin); fre("QLPTSPR.out","w",stdout); memset(a,sizeof(a),0); memset(t,sizeof(t),0); cin>>n; sangnt(n); t[0]=0; a[0]=1; thu(start); return 0; } | |
| | | quanttk33
Tổng số bài gửi : 60 Join date : 23/06/2022 Age : 16 Đến từ : Vietnam
| Tiêu đề: Re: Nguyễn Nhật Quân Sun Sep 04, 2022 8:55 pm | |
| - Code:
-
//Code by QunHaker :3 //WAVIO (Sub1) #include <bits/stdc++.h> #include <iostream> #include <cstring> #include <math.h> #define nmax 1000007 #define fre freopen #define ll long long #define f(i,a,b) for(int i=a;i<=b;i++) using namespace std;
const int inf = trunc(1e9); int n; ll a[nmax], b[nmax], c[nmax], d[nmax]; map <int, int> mp; vector <int> vtr; int k; int res;
bool chekale(int le){ // check so le if(le%2!=0) return true; else return false; }
bool check_wavio(){ for(int i=1;i*2<=k;i++){ if(c[i]>=c[i+1]){ //b[1]=0; //break; return false; } } for(int i=k/2+1;i<=k-1;i++) if(c[i]<=c[i+1]) return false; return true; }
void xuli(){ k=0; f(i,1,n){ if(b[i]==1){ k++; c[k]=a[i]; } } if(check_wavio()){ if(res<k&&chekale(k)){ res=k; f(i,1,k) d[i]=c[i]; } } }
void thu(int i){ f(j,0,1){ b[i]=j; if(i==n){ xuli(); }else{ thu(i+1); } } }
void xuat(){ for(auto i: vtr) cout<<i<<" "; }
int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); fre("WAVIO.inp","r",stdin); fre("WAVIO.out","w",stdout); vtr.clear(); memset(b,sizeof(b),0); cin>>n; f(i,1,n) cin>>a[i]; thu(1); xuat(); f(i,1,res){ printf("%d ", d[i]); } cout<<res<<endl; //cout<<k; return 0; }
| |
| | | Sponsored content
| Tiêu đề: Re: Nguyễn Nhật Quân | |
| |
| | | | Nguyễn Nhật Quân | |
|
Similar topics | |
|
| Permissions in this forum: | Bạn không có quyền trả lời bài viết
| |
| |
| |