Thanks, but my program outputs the same output.Sumon wrote: Sample Input:
5
5 5
5 5 5 5 5
4 4
2 2 4 0
3 4
2 2 4
5 4
2 2 4 0 4
5 4
-1 3 -3 1 1
Sample Output
Case 1: 1
Case 2: 2
Case 3: 1
Case 4: 3
Case 5: 4
Search found 12 matches
- Mon Sep 18, 2006 9:30 am
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies: 36
- Views: 21978
- Sun Sep 17, 2006 3:40 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies: 36
- Views: 21978
- Sat Sep 16, 2006 4:27 pm
- Forum: Volume 101 (10100-10199)
- Topic: 10198 - Counting
- Replies: 30
- Views: 44409
- Sat Sep 16, 2006 1:35 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies: 36
- Views: 21978
- Wed Sep 13, 2006 10:02 am
- Forum: Volume 110 (11000-11099)
- Topic: 11087 - Divisibility Testing
- Replies: 36
- Views: 21978
- Thu Sep 07, 2006 2:47 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11077 - Find the Permutations
- Replies: 14
- Views: 9626
[quote="minskcity] number of permutations which will take at least K swaps should be number of permutations for which minimum number of swaps to sort is K "at least" implies nothing about minimum.
Are you claiming that "1 3 2" does not require "at least 0 swaps" to sort it? Let me know how to sort ...
Are you claiming that "1 3 2" does not require "at least 0 swaps" to sort it? Let me know how to sort ...
- Wed Sep 06, 2006 2:53 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11077 - Find the Permutations
- Replies: 14
- Views: 9626
From problem statement, output section: For each of the input, print in a line the number of permutations which will take at least K swaps. Now, look at the test case#2... The way I see it, any of 3! = 6 permutations of 3 elements require at least 0 swaps to sort.
You should output the number of ...
You should output the number of ...
- Sun Jul 23, 2006 1:31 pm
- Forum: Volume 1 (100-199)
- Topic: 128 - Software CRC
- Replies: 62
- Views: 14547
- Thu Jul 06, 2006 9:58 am
- Forum: Volume 1 (100-199)
- Topic: 128 - Software CRC
- Replies: 62
- Views: 14547
Need Help. Problem 128
What's the formula for this problem?
- Wed Jul 05, 2006 12:09 pm
- Forum: Volume 106 (10600-10699)
- Topic: 10656 - Maximum Sum (II)
- Replies: 52
- Views: 23572
- Sat Jul 01, 2006 12:59 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10324 - Zeros and Ones
- Replies: 179
- Views: 66955
Re: 10324 Help me ! or i will DIE
At least I got Accepted! :wink: Here is my code:
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
char c[1000005];
int m[1000005];
int main()
{
int n,a,b,i,ii=0,k;
while(scanf("%s",c)!=EOF)
{
ii++;
cout<<"Case "<<ii<<':'<<endl;
m[0]=0;
k=strlen(c);
for(i=1;i<k;i ...
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
char c[1000005];
int m[1000005];
int main()
{
int n,a,b,i,ii=0,k;
while(scanf("%s",c)!=EOF)
{
ii++;
cout<<"Case "<<ii<<':'<<endl;
m[0]=0;
k=strlen(c);
for(i=1;i<k;i ...
- Sat Jul 01, 2006 12:55 pm
- Forum: Volume 103 (10300-10399)
- Topic: 10324 - Zeros and Ones
- Replies: 179
- Views: 66955
Re: 10324 Help me ! or i will DIE
Why I got TLE?? :cry:
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
char c[1000005];
int m[1000005];
int main()
{
int n,a,b,i,ii=0;
while(scanf("%s",c)!=EOF)
{
ii++;
cout<<"Case "<<ii<<':'<<endl;
m[0]=0;
for(i=1;i<strlen(c);i++)
{
if(c !=c[i-1]) m =m[i-1]+1 ...
#include <iostream>
#include <cstdio>
#include <string>
using namespace std;
char c[1000005];
int m[1000005];
int main()
{
int n,a,b,i,ii=0;
while(scanf("%s",c)!=EOF)
{
ii++;
cout<<"Case "<<ii<<':'<<endl;
m[0]=0;
for(i=1;i<strlen(c);i++)
{
if(c !=c[i-1]) m =m[i-1]+1 ...