|
|
back to boardThe worst uptimization!!! Posted by Wasdek 2 Dec 2013 13:58 #include <iostream> int main() { using namespace std; int a, b, buffer; cin>>a>>b; int *mass=new int[b]; int *deep=new int[33180]; for (int i4=0; i4<b; i4++) { mass[i4]=0; deep[i4]=1200; } for (int i5=b; i5<33180; i5++) { deep[i5]=a; } for (int i6=0; i6<33180; i6++) { for (int i9=1; i9<33180; i9++) { if (deep[i9-1]>deep[i9]) { buffer=deep[i9-1]; deep[i9-1]=deep[i9]; deep[i9]=buffer; } } } mass[0]=a; mass[b-1]=b; for (int i=0; i<b; i++) { for (int i2=1; i2<b; i2++) { if (mass[i2-1]>mass[i2]) { buffer=mass[i2-1]; mass[i2-1]=mass[i2]; mass[i2]=buffer; } } } int sum=0; for (int i3=0; i3<b; i3++) { sum+=mass[i3]; } cout<<sum; delete []deep; delete []mass; return 0; } This solution works 1 second and output 1 if a=1 or b=1, and get AC! Re: The worst uptimization!!! Posted by Айарпи 28 Jan 2014 15:09 :) |
|
|