Advertisement
Guest User

Untitled

a guest
Dec 7th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. #include <fstream>
  2. using namespace std;
  3.  
  4. void fill(int **m, int x1, int y1, int x2, int y2)
  5. {
  6. for(int i=x1; i<x2; ++i)
  7. for(int j=y1; j<y2; ++j)
  8. m[i][j] = 1;
  9. }
  10.  
  11. int main()
  12. {
  13. ifstream in("input.txt");
  14. ofstream out("output.txt");
  15. int i, j;
  16. int w, h;
  17. int **field;
  18.  
  19. in >> w >> h;
  20. field = new int*[h];
  21. for(i=0; i<h; ++i)
  22. field[i] = new int[w];
  23.  
  24. for(i=0; i<h; ++i)
  25. for(j=0; j<w; ++j)
  26. field[i][j] = 0; // чистим
  27.  
  28. int n; // число прямоугольников
  29. int x1,y1,x2,y2;
  30. in >> n;
  31.  
  32. for(i=0;i<n; ++i)
  33. {
  34. in >> x1 >> y1 >> x2 >> y2;
  35. fill(field, x1,y1,x2,y2);
  36. }
  37.  
  38. int hole = 0;
  39. for(i=0; i<h; ++i)
  40. {
  41. for(j=0; j<w; ++j)
  42. {
  43. // out << field[i][j] << ' ';
  44. if(field[i][j] == 0)
  45. ++hole;
  46. }
  47. // out << '\n';
  48. }
  49. out << hole;
  50. return 0;
  51. }
  52.  
  53. i=input()
  54. n=0
  55. b=0
  56. maks=0
  57. while n<len(i):
  58. if i[n]=='0':
  59. b+=1
  60. if maks<b:
  61. maks=b
  62. else:
  63. b=0
  64. n+=1
  65. print(maks)
  66.  
  67.  
  68. using System;
  69.  
  70. public class Program
  71. {
  72. public static void Main()
  73. {
  74. string m=Console.ReadLine();
  75. char[] s=m.ToCharArray();
  76. int sum=0;
  77. for(int i=0;i<s.Length-4;i++)
  78. 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]=='<'))
  79. sum++;
  80. Console.WriteLine(sum);
  81. }
  82. }
  83.  
  84.  
  85. #include <iostream>
  86. using namespace std;
  87. int main()
  88. {
  89. int n,a=0,b=1,c=0,i=0;
  90. cin>>n;
  91. while (c<n)
  92. {
  93. a=b;
  94. b=c;
  95. c=a+b;
  96. i++;
  97. }
  98. if(c==n)cout<<1<<endl<<i;
  99. else cout<<0;
  100. }
  101.  
  102. using System;
  103. using System.Collections.Generic;
  104. using System.Linq;
  105.  
  106. public class Program
  107. {
  108. public static void Main()
  109. {
  110. int n=int.Parse(Console.ReadLine());
  111. string[] l=Console.ReadLine().Split(' ');
  112. string[] l1=Console.ReadLine().Split(' ');
  113. int y=1;
  114. double max;
  115. double[] m=new double[n];
  116. double[] m1=new double[n];
  117. for(int i=0;i<n;i++)
  118. m[i]=Convert.ToDouble(l[i]);
  119. for(int i=0;i<n;i++)
  120. m1[i]=Convert.ToDouble(l1[i]);
  121. max=m[0]*m1[0]/100;
  122. for(int i=1;i<n;i++)
  123. if(m[i]*m1[i]/100>max)
  124. {max=m[i]*m1[i]/100;
  125. y=i+1;}
  126. Console.WriteLine(y);
  127. }
  128. }
  129.  
  130.  
  131. #include <iostream>
  132. using namespace std;
  133. int main()
  134. {
  135. int n, i, c, d;
  136. cin >> n;
  137. int *a = new int[n];
  138. for (i = 0; i < n; i++)
  139. cin >> a[i];
  140. for (i = 0; i < n; i++)
  141. {
  142. c = a[i] + 1;
  143. d = a[i] - 1;
  144. 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)
  145. cout << "Yes" << endl;
  146. else
  147. cout << "No" << endl;
  148. }
  149. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement