__________________________________
문제의 방법 임시 클래스 :
(1) 메커니즘 분석. 분석 대상 설명, 발사 알고리즘.
(2) 통계 분석. 최종 수학적 모델을 추구.
문제 1 :
기적은 1960 년에 시작합니다.
(k)의 n 번째 비트 = 2 ^ (2+ (Y-1960) / 10), 부호없는 정수의 큰 (2 ^ k)는 -1, 우리가 도입 번호 k 번째 비트에 배치 될 수있다 작업 :
--------------은 https : //vjudge.net/contest/317081#problem/A
암호:
#include<stdio.h> #include<math.h> int main() { int year; int endflag; int n; double sum; while(scanf("%d",&year),year) { endflag=1<<((year-1960)/10+2);// 1<<a==pow(2,a) n=2; sum=0; while(sum<=endflag) { sum+=log(n)/log(2);//log2(n)! n++; } printf("%d\n",n-2); } return 0; }
Problem 2:
https://vjudge.net/contest/317081#problem/C
#include<iostream> #include<cstdio> using namespace std; int t,d,m,n,min_,max_; int main() { scanf("%d",&t); while(t--) { scanf("%d%d",&m,&n); min_=max_=0;//双双赋值! while(n--) { scanf("%d",&d); min_=max(min_,min(d,m-d)); max_=max(max_,max(d,m-d)); } printf("%d %d\n",min_,max_); } return 0; }