Advertisement
suncastic_

Untitled

Feb 19th, 2020
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.29 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5.  
  6. int year;
  7.  
  8. cin>>year;
  9.  
  10. if(year%400==0 or (year%4==0 and year%100!=0) ){
  11.  
  12. cout<<"366"<<endl;
  13. }else{
  14.  
  15. cout<<"365"<<endl;
  16. }
  17. }
  18.  
  19.  
  20.  
  21.  
  22. #include <iostream>
  23. using namespace std;
  24.  
  25. int main() {
  26.  
  27. int first, second;
  28.  
  29. cin>>first>>second;
  30.  
  31. if(first==1){
  32.  
  33. first=1;
  34. }else if(first==2){
  35.  
  36. first=2;
  37. }else if(first==3){
  38.  
  39. first=4;
  40. }else if(first==4){
  41.  
  42. first=6;
  43. }else if(first==5){
  44.  
  45. first=8;
  46. }else if(first==6){
  47.  
  48. first=12;
  49. }
  50.  
  51. if(second==1){
  52.  
  53. second=1;
  54. }else if(second==2){
  55.  
  56. second=2;
  57. }else if(second==3){
  58.  
  59. second=4;
  60. }else if(second==4){
  61.  
  62. second=6;
  63. }else if(second==5){
  64.  
  65. first=8;
  66. }else if(second==6){
  67.  
  68. second=12;
  69. }
  70.  
  71. if(first>second){
  72.  
  73. cout<<"first "<<first-second<<endl;
  74. }else{
  75.  
  76. cout<<"second "<<second-first<<endl;
  77. }
  78. }
  79.  
  80.  
  81. #include <iostream>
  82. using namespace std;
  83.  
  84. int main() {
  85.  
  86. int number, sum=0, temp;
  87.  
  88. cin>>number;
  89.  
  90. while(number>0){
  91.  
  92. temp = number%10;
  93. if(temp%2==0){
  94.  
  95. sum=sum+temp;
  96. }
  97. number=number/10;
  98. }
  99.  
  100. cout<<sum<<endl;
  101.  
  102. }
  103.  
  104.  
  105.  
  106. #include <iostream>
  107. using namespace std;
  108.  
  109. int main() {
  110.  
  111. int number, sum=0, temp;
  112.  
  113. cin>>number;
  114.  
  115. while(number>0){
  116.  
  117. temp = number%10;
  118. if(temp>3 and temp<6){
  119.  
  120. sum=sum+temp;
  121. }
  122. number=number/10;
  123. }
  124.  
  125. cout<<sum<<endl;
  126.  
  127. }
  128.  
  129.  
  130.  
  131. #include <iostream>
  132. using namespace std;
  133.  
  134. int main() {
  135.  
  136. int number, sum=0, temp,br=0;
  137.  
  138. cin>>number;
  139.  
  140. while(number>0){
  141.  
  142. temp = number%10;
  143. sum=sum+temp;
  144. number=number/10;
  145. br++;
  146. }
  147.  
  148. cout<<sum/br<<endl;
  149.  
  150. }
  151.  
  152.  
  153. #include <iostream>
  154. using namespace std;
  155.  
  156. int main() {
  157.  
  158. int number, sum=0, temp,br=0;
  159.  
  160. cin>>number;
  161.  
  162. while(number>0){
  163.  
  164. temp = number%10;
  165. if(temp>3 and temp<7){
  166.  
  167. sum=sum+temp;
  168. br++;
  169. }
  170. number=number/10;
  171. }
  172.  
  173. cout<<sum/br<<endl;
  174. }
  175.  
  176. #include <iostream>
  177. using namespace std;
  178.  
  179. int main() {
  180.  
  181. int n, m, a,br=1,sum=0,index;
  182. cin >> n >> m;
  183. cin >> a;
  184. sum += a;
  185. int min = a;
  186. while (sum < m and br < n)
  187. {
  188. cin >> a;
  189. br++;
  190. sum += a;
  191. if (sum < m and br < n)
  192. {
  193. if (min > a)
  194. {
  195. min = a;
  196. index = br;
  197. }
  198. }
  199. }
  200. cout << index;
  201. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement