|
|
вернуться в форумWA in #5 Help PLEASE #include <iostream> #include <algorithm> #include <cstdio> #include <algorithm> #include <cstdlib> #include <cstring> #define fi "Democracy in Danger.in" #define fo "Democracy in Danger.out" using namespace std; int m; int k; long long sum; int a[102]; void init_file(){ freopen(fi, "r", stdin); freopen(fo, "w", stdout); }
void readdata(){ scanf("%d", &k); for (int i = 1; i <= k; i ++){ scanf("%d", a + i); } // printf("%d\n", a[1]); } int half(int k){ return ((k >> 1) + 1); } void work(){ sum = 0; sort(a, a + k + 1); m = half(k); for (int i = 1; i <= m; i++){ sum += half(a[m]); } printf("%d", sum); }
int main(){ //init_file(); readdata(); work(); return 0; } My code is above. Could u Please tell me why I had a WA in #5. 3q very much Re: WA in #5 Help PLEASE Послано Vlad 17 янв 2012 09:48 the same shit WA5 |
|
|