Anonymous
Help?
Raul
Help?
It's like I said, I don't know what you are trying to attempt with this program.
First, I can tell you that you have not include, vector, stringstream, and string.
But what are you trying to do with this program??
Anonymous
I am not able to use stringstream
Anonymous
😔
Ибраги́м
https://www.youtube.com/watch?v=M_Mrk1xHMoo
Mihail
It's like implementing it with normal functions, but slower, so why would you?
Raul
Or vector
Raul
Or string
BinaryByter
kek, did you use a website where you only need to write the basic code?
BinaryByter
I know that on freecodecamp, you don't learn HTML fully, you just learn little bits
BinaryByter
which you can never use completely
Anonymous
Untitled1.cpp
Anonymous
In this code just make the change in the argument of function count1...it is void not int t
Mandelbröt
Mandelbröt
Hey anyone here to help
Mandelbröt
And get out of it
Mandelbröt
#include<bits/stdc++.h>
using namespace std;
vector<int> leftrotate(vector<int>& b,int low,int high){
int q,temp1=b[low];
for(q=0;q<high-1;q++){
b[q]=b[q+1];
}
b[q]=temp1;
return b;
}
vector<int> rightrotate(vector<int>& c,int l,int h){
int temp2=c[h];
for(int z=h-1;z>1;z--){
c[z]=c[z-1];
}
c[l]=temp2;
return c;
}
int main()
{
int q;
cin>>q;
for(int j=0;j<q;j++){
int i,p=1,count1=0,n;
cin>>n;
vector<int> a;
for(i=0;i<n;i++){
int temp;
cin>>temp;
a.push_back(temp);
}
while(p<=n){
for(i=0;i<n;i++){
if(a[i]==p){
if(i>(p-1)){
count1+=(i-(p-1));
if((i-(p-1))==1){
swap(a[p-1],a[i]);
}
else{rightrotate(a,(p-1),i);}
}
else if((p-1)>i){
count1+=((p-1)-i);
if(((p-1)-i)==1){
swap(a[p-1],a[i]);
}
else{leftrotate(a,i,(p-1));}
}
++p;
break;
}
}
}
if(count1>3){
cout<<"Too chaotic"<<"\n";
}
else{cout<<count1<<"\n";}}
return 0;
}
Mandelbröt
#include<bits/stdc++.h>
using namespace std;
vector<int> leftrotate(vector<int>& b,int low,int high){
int q,temp1=b[low];
for(q=0;q<high-1;q++){
b[q]=b[q+1];
}
b[q]=temp1;
return b;
}
vector<int> rightrotate(vector<int>& c,int l,int h){
int temp2=c[h];
for(int z=h-1;z>1;z--){
c[z]=c[z-1];
}
c[l]=temp2;
return c;
}
int main()
{
int q;
cin>>q;
for(int j=0;j<q;j++){
int i,p=1,count1=0,n;
cin>>n;
vector<int> a;
for(i=0;i<n;i++){
int temp;
cin>>temp;
a.push_back(temp);
}
while(p<=n){
for(i=0;i<n;i++){
if(a[i]==p){
if(i>(p-1)){
count1+=(i-(p-1));
if((i-(p-1))==1){
swap(a[p-1],a[i]);
}
else{rightrotate(a,(p-1),i);}
}
else if((p-1)>i){
count1+=((p-1)-i);
if(((p-1)-i)==1){
swap(a[p-1],a[i]);
}
else{leftrotate(a,i,(p-1));}
}
++p;
break;
}
}
}
if(count1>3){
cout<<"Too chaotic"<<"\n";
}
else{cout<<count1<<"\n";}}
return 0;
}
This is the code i have written for the above problem the new year chaos whic i had already sent in pdf format
Mandelbröt
My testcase get wrong due to timeout
Mandelbröt
Can anyone programmer here in group to help me get me out from this problem
Anonymous
http://this.is-a-professional-domain.com/GR7PZ7o.png
Anonymous
It cant find the SFML files
Elnee
Why
cout<<"Too chaotic"<<"\n";
When you can
cout << "Too chaotic\n";
Mihail
Mat
#include<bits/stdc++.h>
using namespace std;
vector<int> leftrotate(vector<int>& b,int low,int high){
int q,temp1=b[low];
for(q=0;q<high-1;q++){
b[q]=b[q+1];
}
b[q]=temp1;
return b;
}
vector<int> rightrotate(vector<int>& c,int l,int h){
int temp2=c[h];
for(int z=h-1;z>1;z--){
c[z]=c[z-1];
}
c[l]=temp2;
return c;
}
int main()
{
int q;
cin>>q;
for(int j=0;j<q;j++){
int i,p=1,count1=0,n;
cin>>n;
vector<int> a;
for(i=0;i<n;i++){
int temp;
cin>>temp;
a.push_back(temp);
}
while(p<=n){
for(i=0;i<n;i++){
if(a[i]==p){
if(i>(p-1)){
count1+=(i-(p-1));
if((i-(p-1))==1){
swap(a[p-1],a[i]);
}
else{rightrotate(a,(p-1),i);}
}
else if((p-1)>i){
count1+=((p-1)-i);
if(((p-1)-i)==1){
swap(a[p-1],a[i]);
}
else{leftrotate(a,i,(p-1));}
}
++p;
break;
}
}
}
if(count1>3){
cout<<"Too chaotic"<<"\n";
}
else{cout<<count1<<"\n";}}
return 0;
}
Read the pinned message
Mandelbröt
#include<bits/stdc++.h>
using namespace std;
vector<int> leftrotate(vector<int>& b,int low,int high){
int q,temp1=b[low];
for(q=0;q<high-1;q++){
b[q]=b[q+1];
}
b[q]=temp1;
return b;
}
vector<int> rightrotate(vector<int>& c,int l,int h){
int temp2=c[h];
for(int z=h-1;z>1;z--){
c[z]=c[z-1];
}
c[l]=temp2;
return c;
}
int main()
{
int q;
cin>>q;
for(int j=0;j<q;j++){
int i,p=1,count1=0,n;
cin>>n;
vector<int> a;
for(i=0;i<n;i++){
int temp;
cin>>temp;
a.push_back(temp);
}
while(p<=n){
for(i=0;i<n;i++){
if(a[i]==p){
if(i>(p-1)){
count1+=(i-(p-1));
if((i-(p-1))==1){
swap(a[p-1],a[i]);
}
else{rightrotate(a,(p-1),i);}
}
else if((p-1)>i){
count1+=((p-1)-i);
if(((p-1)-i)==1){
swap(a[p-1],a[i]);
}
else{leftrotate(a,i,(p-1));}
}
++p;
break;
}
}
}
if(count1>3){
cout<<"Too chaotic"<<"\n";
}
else{cout<<count1<<"\n";}}
return 0;
}
Hey i m not asking for \n or endl
Mandelbröt
I m asking the error which i get
Mandelbröt
Can anyone able to correct it ....
Mandelbröt
Thanks
Mat
Read the pinned message about long code
Mat
Furthermore: does it give timeout on every test?
Mandelbröt
No not on every test ...
Mandelbröt
Just it passes the sample test case
Mandelbröt
Only 3
Mandelbröt
But there are more wrong ones
Mandelbröt
Ab....Hannan
Ab....Hannan Bahrami:
How can we write a programm
that print all english alphabet from A till z (like this:Aa,Bb,Cc..........Zz).
Help me.
BinaryByter
you already asked that here
BinaryByter
I told you how to do it
BinaryByter
this is pretty much a trivial program to do now
BinaryByter
if you are this dense, stop studying computer science
Ab....Hannan
BinaryByter
Thanks bro
Why do you say thank you for insulting me?
BinaryByter
maxi is confused
BinaryByter
it hurts itself in its confusion
BinaryByter
your attack was super effective
BinaryByter
xD
BinaryByter
BinaryByter
i'm having fun with asm ;_;
BinaryByter
No, i told you how to do it
BinaryByter
I gave you all you needed
BinaryByter
you could use the ascii table
BinaryByter
—> you said that you know what that is
BinaryByter
you could have asked more details about how to use it
BinaryByter
But also, you could just do this:
BinaryByter
cout « "AaBbCcDdEeFfGgH...";
Ab....Hannan
BinaryByter
Sure
BinaryByter
Prometheus
Ooo where do I get one?
BinaryByter
germany only
Prometheus
Maybe I’ll just try this:
printl(“Andrew is the smartest man alive. Even smarter than maxi.”); C is the best language so it must be true if the compiler lets it go through.
BinaryByter
std::cout « "Maxi is the smartest man alive. even smarter than andrew";
BinaryByter
c++ is the best language
BinaryByter
❤️
BinaryByter
Mihail
Only thing I can do here is add an asm variant
Mihail
But if I'm writing it's probs gonna segafault anyways
Mihail
So nah
BinaryByter
xD
Prometheus
It’s ok. Not everyone has the cajones to try even in the face of failure
BinaryByter