Today's contest-Problem solving report

Source: Internet
Author: User

B-bTime limit:2000MS Memory Limit:262144KB 64bit IO Format:%i64d &%I 64u Submit Status Practice codeforces 554B

Description

Ohana Matsumae is trying to the clean a-a, which is divided-to-a n by n grid of squares. Each square was initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom was very strange:if she sweeps over a clean square, it would become dirty, and if she sweeps over a dirty square, It'll become clean. She wants to sweep some columns of the and the number of rows that is maximize clean. It is not a allowed to sweep over the "the" column, Ohana can only sweep the whole column.

Return the maximum number of rows that she can make completely clean.

Input

The first line of input is a single integer n (1≤ n ≤100).

The next n Lines would describe the state of the The. The i-th line would contain a binary string with n characters denoting the state of the I -th row of the. The J-th character on this line is ' 1 ' if the J-th Square in the I-th row is Clean, and ' 0 ' if it is dirty.

Output

The output should is a single line containing an integer equal to a maximum possible number of rows that is completely cl Ean.

Sample Input

Input
4
0101
1000
1111
0101
Output
2
Input
3
111
111
111
Output
3

Hint

In the first sample, Ohana can sweep the 1st and 3rd columns. This'll make the 1st and 4th row is completely clean.

In the second sample, everything are already clean, so Ohana doesn ' t need to do anything.

How to solve the problem: the main idea is to calculate how many rows are equal and output the maximum number of rows

Code

#include <iostream>
#include <string.h>
#include <cstdio>

using namespace std;
string a[100];
int b[100];
int main ()
{
int n,i=0,m=0;
memset (b,0,sizeof (b));
Cin>>n;int j=n;
While (n--)
{
cin>>a[i];
for (int j=i;j>=0;j--)
if (a[j]==a[i]) b[i]++;
if (b[i]>m) m=b[i];
i++;
}
cout<<m<<endl;

return 0;
}

c-cTime limit:1000MS Memory Limit:262144KB 64bit IO Format:%i64d & ; %i64u Submit Status Practice codeforces 492A

Description

Vanya got n cubes. He decided to build a pyramid from them. Vanya wants to build the pyramid as follows:the top level of the pyramid must consist of 1 cubes, the second level Mus T consist of 1 + 2 = 3 cubes, the third level must has 1 + 2 + 3 = 6 cubes, and so on. Thus, the I-th level of the pyramid must has 1 + 2 + ... + (i -1) + i cubes.

Vanya wants to know, the maximum height of the pyramid, the he can make using the given cubes.

Input

The first line contains an integer n (1≤ n ≤104)-the number of cubes given to Vanya.

Output

Print the maximum possible height of the pyramid in the

Sample Input

Input
1
Output
1
Input
25
Output
4

Hint

Illustration to the second sample:

Problem-solving ideas: The main idea is to accumulate ideas, the number of the nth line from the 1+2+....+n, so an n-line high pyramid sum is 1+ (1+2) + (1+2+3) +.....+ (1+2+3+. +n) code: #include <iostream> using namespace std; int main () { int n,t; cin>>n; int i,sum=0,j=1; While (sum<=n) {t=0; For (i=1;i<=j;i++) t+=i; sum+=t;j++;     } cout<<j-2<<endl; return 0; } F-f Time Limit:1000MS Memory Limit:131072KB 64bit IO Format:%LLD &%llusubmit Status Practice CSU 1337

Description

Flt theorem: When n>2, the indefinite equation AN+BN=CN has no positive integer solution. For example, A3+B3=C3 does not have a positive integer solution. To enliven the atmosphere, we might as well have a funny version: Change the equation to a3+b3=c3, so there are solutions, such as a=4, B=9, c=79 43+93=793.

Enter two integers x, y, to satisfy the x<=a,b,c<=y number of integer solutions.

Input

Enter up to 10 sets of data. Each set of data contains two integers x, y (1<=x,y<=108).

Output

For each set of data, the number of output solutions.

Sample Input

Sample Output




Problem Solving Ideas:
Although the range of x and Y is 10^8, if a is greater than 1000, then the a^3 will be greater than 10^9, so that the right side of the equal sign is only one x C + 3, the maximum can only reach the 10^9 order of magnitude, so, regardless of the number of inputs and y is how many, We just have to take the interval between 1 and 1000, enumerate A and B, then C can get it and then judge whether the range of C is between x and Y, so that the time complexity drops to 10^6.
 with the above analysis, the problem is very simple;
Program code:

#include <iostream>

#include <cstdio>
using namespace std;

int a,b,c,d,x,y,i=0;
int main ()
{
While (cin>>x>>y)
{int m=0;
For (a=x;a<=y&&a<=1000;a++)
For (b=x;b<=y&&b<=1000;b++)
        {
c=a*a*a+b*b*b;
if (c%10==3)
{d= (c-3)/10;
if (d>=x&&d<=y) m++;
            }

        }
cout<< "Case" <<++i<< ":" <<m<<endl;
    }
return 0;
}


Today's contest-Problem solving report

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.