Skip to content

Instantly share code, notes, and snippets.

@zuigon
Created December 29, 2009 20:25
Show Gist options
  • Save zuigon/265569 to your computer and use it in GitHub Desktop.
Save zuigon/265569 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <math.h>
using namespace std;
int n[3];
char x[6][6];
int br[6];
int max_br(){
int max=0;
for(int i=0; i<6; i++)
if(br[i]>max) max=br[i];
return max;
}
int main(int argc, char** argv){
cin >> n[0]>>n[1]>>n[2];
sprintf(x[0], "%d%d%d", n[0],n[1],n[2]);
sprintf(x[1], "%d%d%d", n[0],n[2],n[1]);
sprintf(x[2], "%d%d%d", n[1],n[0],n[2]);
sprintf(x[3], "%d%d%d", n[1],n[2],n[0]);
sprintf(x[4], "%d%d%d", n[2],n[0],n[1]);
sprintf(x[5], "%d%d%d", n[2],n[1],n[0]);
for(int i=0; i < 6; i++)
sscanf(x[i], "%d", &br[i]);
// for(int i=0; i<6; i++){
// cout <<"! "<<x[i]<<endl;
// }
// cout << "Brojevi: "<<endl;
// for(int i=0; i<6; i++)
// cout << "! "<<br[i]<<endl;
cout <<max_br()<<endl; //MAX
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment