Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- using namespace std;
- void fill(int **m, int x1, int y1, int x2, int y2)
- {
- for(int i=x1; i<x2; ++i)
- for(int j=y1; j<y2; ++j)
- m[i][j] = 1;
- }
- int main()
- {
- ifstream in("input.txt");
- ofstream out("output.txt");
- int i, j;
- int w, h;
- int **field;
- in >> w >> h;
- field = new int*[h];
- for(i=0; i<h; ++i)
- field[i] = new int[w];
- for(i=0; i<h; ++i)
- for(j=0; j<w; ++j)
- field[i][j] = 0; // чистим
- int n; // число прямоугольников
- int x1,y1,x2,y2;
- in >> n;
- for(i=0;i<n; ++i)
- {
- in >> x1 >> y1 >> x2 >> y2;
- fill(field, x1,y1,x2,y2);
- }
- int hole = 0;
- for(i=0; i<h; ++i)
- {
- for(j=0; j<w; ++j)
- {
- // out << field[i][j] << ' ';
- if(field[i][j] == 0)
- ++hole;
- }
- // out << '\n';
- }
- out << hole;
- return 0;
- }
- i=input()
- n=0
- b=0
- maks=0
- while n<len(i):
- if i[n]=='0':
- b+=1
- if maks<b:
- maks=b
- else:
- b=0
- n+=1
- print(maks)
- using System;
- public class Program
- {
- public static void Main()
- {
- string m=Console.ReadLine();
- char[] s=m.ToCharArray();
- int sum=0;
- for(int i=0;i<s.Length-4;i++)
- if((s[i]=='>' && s[i+1]=='>' && s[i+2]=='-' && s[i+3]=='-' && s[i+4]=='>') || (s[i]=='<' && s[i+1]=='-' && s[i+2]=='-' && s[i+3]=='<' && s[i+4]=='<'))
- sum++;
- Console.WriteLine(sum);
- }
- }
- #include <iostream>
- using namespace std;
- int main()
- {
- int n,a=0,b=1,c=0,i=0;
- cin>>n;
- while (c<n)
- {
- a=b;
- b=c;
- c=a+b;
- i++;
- }
- if(c==n)cout<<1<<endl<<i;
- else cout<<0;
- }
- using System;
- using System.Collections.Generic;
- using System.Linq;
- public class Program
- {
- public static void Main()
- {
- int n=int.Parse(Console.ReadLine());
- string[] l=Console.ReadLine().Split(' ');
- string[] l1=Console.ReadLine().Split(' ');
- int y=1;
- double max;
- double[] m=new double[n];
- double[] m1=new double[n];
- for(int i=0;i<n;i++)
- m[i]=Convert.ToDouble(l[i]);
- for(int i=0;i<n;i++)
- m1[i]=Convert.ToDouble(l1[i]);
- max=m[0]*m1[0]/100;
- for(int i=1;i<n;i++)
- if(m[i]*m1[i]/100>max)
- {max=m[i]*m1[i]/100;
- y=i+1;}
- Console.WriteLine(y);
- }
- }
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, i, c, d;
- cin >> n;
- int *a = new int[n];
- for (i = 0; i < n; i++)
- cin >> a[i];
- for (i = 0; i < n; i++)
- {
- c = a[i] + 1;
- d = a[i] - 1;
- if (c / 100000 + c / 10000 % 10 + c / 1000 % 10 == c % 10 + c % 100 / 10 + c % 1000 / 100 || d / 100000 + d / 10000 % 10 + d / 1000 % 10 == d % 10 + d % 100 / 10 + d % 1000 / 100)
- cout << "Yes" << endl;
- else
- cout << "No" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement