Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
Anas-Hamo23 committed Aug 31, 2023
1 parent 84f288b commit 945ef33
Show file tree
Hide file tree
Showing 2 changed files with 60 additions and 0 deletions.
32 changes: 32 additions & 0 deletions ICPC Assiut University Community/Sheet #2 (Loops)/W - Shape3.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#include <bits/stdc++.h>
#include <typeinfo>
#include <type_traits>
using namespace std;
#define ll_a long long
#define ll_u unsigned long long
#define sort_Vector(v) sort(v.begin(),v.end())
#define sort_Array(a,n) sort(a,a+n)
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

int main() {
fast
int n;cin>>n;
for(int i=1;i<=n;i++){
for(int j=0;j<n-i;j++){
cout<<" ";
}
for(int l=0;l<i*2-1;l++){
cout<<"*";
}cout<<endl;
}
for(int i=n;i>=1;i--){
for(int j=0;j<n-i;j++){
cout<<" ";
}
for(int l=0;l<i*2-1;l++){
cout<<"*";
}cout<<endl;
}

return 0;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <bits/stdc++.h>
#include <typeinfo>
#include <type_traits>
using namespace std;
#define ll_a long long
#define ll_u unsigned long long
#define sort_Vector(v) sort(v.begin(),v.end())
#define sort_Array(a,n) sort(a,a+n)
#define fast ios_base::sync_with_stdio(false);cin.tie(nullptr);cout.tie(nullptr);

int main() {
fast
int n;cin>>n;
int x=0,y=1,fibo=0;
if(n>=1){
cout<<0<<" ";
}
if(n>=2){
cout<<1<<" ";
}
for(int i=3;i<=n;i++){
fibo=x+y;
x=y;y=fibo;
cout<<fibo<<" ";
}

return 0;
}

0 comments on commit 945ef33

Please sign in to comment.