摘要:
1 #include 2 #include 3 4 using namespace std; 5 6 class TheArithmeticProgression{ 7 public: 8 double minimunChange(int a,int b, int c){ 9 return (abs(2*b-a-c)+0.0)/2;10 }11 12 }; 阅读全文
摘要:
1 #include 2 #include 3 #include 4 #include 5 #define LL long long 6 7 using namespace std; 8 9 class LittleElephantAndPermutationDiv2{10 public:11 LL getNumber(int N, int k){12 LL res = 0;13 vector a(N);14 for(int i = 0 ; i = k ) ++res;23 copy(a.begi... 阅读全文
摘要:
1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 class WolfDelaymaster{ 8 public: 9 bool checkChar(string str, char c, int start ,int num){10 for(int i = start; i < start + num; ++ i ){11 if(str[i] != c) return false;12 }13 return true;14 ... 阅读全文
摘要:
此题主要考查的是求最长公共子序列设A[i]:A[j] = a:b = ac:bc B[ii]:B[jj] = c:d = ac:ad ,如果A[i]:A[j] = B[ii]:B[jj]则bc= ad,所以A乘以B的倍数,B乘以A的倍数,则A与B所求的序列必然是一样的,即求A与B的最长公共子序列 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 class AstronomicalRecordsEasy{ 8 public: 9 int minimalPlanets(vector A, vecto... 阅读全文
摘要:
暴力枚举 1 #include 2 #include 3 #include 4 5 using namespace std; 6 7 class FoxAndClassroom{ 8 public: 9 string ableTo(int n , int m){10 for(int i = 0 ; i > visitFlag(n,vector(m,false));13 int kx = i ,ky = j,count = 0;14 while(!visitFlag[kx][ky]){15 ... 阅读全文
摘要:
1 #include 2 #include 3 4 using namespace std; 5 6 int main(){ 7 int m,sum = 0; 8 cin >> m ; 9 vector c(m+1,0);10 for(int i = 1; i > c[i];sum+=c[i];}11 int x,y,firstPart = 0, secondPart = 0,firstIndex = 0, secondIndex =0;12 cin >> x >> y;13 for(firstIndex = 0,secon... 阅读全文