|
|
Common Boardhi, in the acceptable answer the answer of 5 4 is 7 but you can easily understand that the real answer is 6(you can test it by drawing a simple 5 4 table). here is a sample answer: #include <iostream> using namespace std; int main() { int unsigned long long N , M , turn = 0; cin >> N >> M;
while( N > 2 && M > 2){ turn += 4; N -= 2; M -= 2; } if (N == 2 && M > 1 || M == 2 && N > 1) turn += 2;
if (M == 1 && N > 1) turn += 1; cout << turn << endl;
system ("PAUSE"); return 0 ;
} Nope...for 5 4 , answer is 7. For 4 5, answer is 6. Edited by author 05.07.2015 11:06 Edited by author 05.07.2015 11:06 using System; class Program{ static void Main(){ string[] input = Console.ReadLine().Split(new char[]{' ', '\t', '\n'}, StringSplitOptions.RemoveEmptyEntries); string Result = ""; double temp; for (int i = 1; i <= Int32.Parse(input[0]); i++){ temp = Math.Sqrt(((Int32.Parse(input[i]) - 1) * 8) + 1); temp = (temp - 1) / 2; if (temp % 1 == 0) Result += "1 "; else Result += "0 "; } Console.WriteLine(Result); } } Edited by author 04.07.2015 10:47 Can you give me some TEST i have WA 30. Thank you I have WA 30 too((( What did you do to AC? #include<stdio.h> #include<deque> #include<algorithm> using namespace std; class node{ public: int x,y,num; }dum; bool func(node i,node j) { if(i.y > j.y) return true; return false; } int main() { deque<node> city; int n; scanf("%d",&n); for(int i=0;i<n;i++) { scanf("%d %d",&dum.x,&dum.y); dum.num = (i+1); city.push_back(dum); } if(n == 0) {printf("0");return 0;} sort(city.begin(),city.end(),func); for(int i=0;i<n;i+=2) { printf("%d %d\n",city[i].num,city[i+1].num); } } your code is wrong http://ideone.com/2mv3As it prints 3 4 1 2 instead of 1 3 2 4 for the test from description of the problem perhaps it gaves AC so your code is right, tests are wrong or problem description is not completed #include <stdio.h> #include<math.h> int main(){ int a=1; while ( a!= 0){ scanf("%d",&a); if (a>=1) if (a<=4) printf("few\n"); if (a>=5) if (a<=9) printf("several\n"); if (a>=10) if (a<=19) printf("pack\n"); if (a>=20) if (a<=49) printf("lots\n"); if (a>=50) if (a<=99) printf("horde\n"); if (a>=100) if (a<=249) printf("throng\n"); if (a>=250) if (a<=499) printf("swarm\n"); if (a>=500) if (a<=999) printf("zounds\n"); if (a>=1000) printf("legion\n"); } return 0; } Edited by author 02.07.2015 03:53 Or should we have our program do all calculations? I got TL although i'm using the binary tree , and when I looked for a solution on the net i found the same of mine but in another words here is my code: #include <cstdio> #include <cstring> using namespace std; #define max 32002 int a[max]; void update(int i,int n,int v) { while(i<=n) { a[i]+=v; i+=i&(-i); } } int read(int i) { int v=0; while(i>0) { v+=a[i]; i-=i&(-i); } return v; } int main() { int n; scanf("%d",&n);
int b[15010]; memset(a,0,sizeof(a)); memset(b,0,sizeof(b)); for(int i=1;i<=n;i++) { int x,y; scanf("%d %d",&x,&y);
b[read(x)]++; update(x,32002,1); } for(int i=0;i<n;i++) printf("%d \n",b[i]); return 0; } so please help me cause i'm about to lose my mind!!! x and y can be 0; but you are using a 1 indexed FenwickTree! so your update goes on indefinitely! 0 0 5 0 6 1 1 1 Answer: 0 My solution gives right answer on this test, but I still WA on test #4 :( Fixed, now WA 7. PS. Forget it, it was fail of my code. Now AC. Edited by author 04.05.2015 02:54 Edited by author 04.05.2015 16:49 Sandro't have anywhere to teleport him to stay in the point (0;0). Simply calculate the distance of most distant demon! First digit of the numbers will start from 1 and end with non-zero digit.and there will not present any successive zero. Edited by moderator 23.08.2020 01:25 For example I'm going to enter "40". Your program shows "2225", though should have been seen something like "58". If I understood the clause right. var a:array[1..15000] of integer; i:integer; m,n,k:integer; b:array[1..1000000] of longint; j:integer; Begin k:=0; readln(n); for i:=1 to n do read(a[i]); readln(m); for j:=1 to m do readln(b[j]); for i:=1 to n do for j:=1 to m do if b[j]=a[i] then k:=k+1; writeln(k); end. 2 22 22 4 22 22 22 22 Because your answer is 8? why authors didn't rejudge??? some authors got accepted more than 0.5 sec.... i don't understand why? 1+sqrt(2) Edited by author 26.06.2015 05:22 I've just looked through the submission list. Almost everyone had WA #11. Maybe someone with AC can give me some hint about it? Ok, WA #11 is all about TLE |
|
|