[Cpp]/* question A, method: search... Ask (0, 0) to (x, y) to turn a few corners !! */# Include <iostream> # include <cstdio> # include <cmath> # include <algorithm> # include <string> using namespace std; # define manx 10000 int sum, xx, yy; void dfs (int x, int y) {if (x> 0 & y> 0) {if (yy = y & xx <x & xx> = (-x) {cout <sum <endl; return ;} /// Nima. The equal sign is incorrect. It has been a long time for WA !!! Sum ++; dfs (-x, y);} else if (x> 0 & y <0) {if (xx = x & yy <= (-y + 1) & yy> y) {cout <sum <endl; return;} sum ++; dfs (x,-y + 1);} else if (x <0 & y <0) {if (yy = y & xx <= (-x + 1) & xx> x) {cout <sum <endl; return;} sum ++; dfs (-x + 1, y);} else if (x <0 & y> 0) {if (xx = x & yy> = (-y) & yy <y) {cout <sum <endl; return;} sum ++; dfs (x,-y );} else if (x = 0 & y = 0) {if (yy = y & xx <= (x + 1) & xx> x) {cout <sum <end L; return;} sum ++; dfs (x + 1, y);} else if (x = 1 & y = 0) {if (xx = x & yy <= (y + 1) & yy> y) {cout <sum <endl; return;} sum ++; dfs (x, y + 1) ;}} int main () {while (cin> xx> yy) {if (xx = 0 & yy = 0) {cout <"0" <endl; continue;} sum = 0; dfs (0, 0) ;}} [cpp]/* B Question, method: queue or simulation... Question: Find the continuous child segment and the maximum length of t... */# Include <iostream> # include <cstdio> # include <algorithm> # include <cmath> using namespace std; # define manx 100009 int x [manx]; long s [manx]; int main () {int n, t; while (cin> n> t) {long k = 1, max = 0, p; long sum = 0; for (int I = 1; I <= n; I ++) {scanf ("% d", & x [I]); sum + = x [I]; while (sum> t) {p = I-k; if (max <p) max = p; sum-= x [k]; k ++ ;}}if (sum <= t) {p = n-k + 1; if (max <p) max = p ;} cout <max <endl ;}/ * 4 5 3 1 2 1 4 6 3 1 4 */