int main() { int i,j,k,prime[100000]={0}; long sum; for(i=2;i<1000;i++) for(j=2*i;j<1000000;j+=i) if(a[j]==0)a[j]=1; k=1;move=0; for(j=2;j<1000000;j++) if(a[j]==0) prime[k++]=j; j=0; for(i=1;i<k;i++) { sum+=prime[i]; move++; Con(prime,sum,i,j); while(sum>1000000) { sum-=prime[j++]; move++; } } printf("%d %d %d\n",pos,max,move); system("pause"); }
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR pCmdLine, int nCmdShow) { // Register the window class. const char CLASS_NAME[] = "RDFT Systems, Inc."; Con(); std::cout << "*********************************************************\n"; std::cout << "* RDFT Minigame and Engine Demo *\n"; std::cout << "* Copyright (c) 2014 RDFT Systems, Inc. *\n"; std::cout << "* Michael Davies, Daniel Shauger, Matt Wilkinson *\n"; std::cout << "*********************************************************\n"; std::cout << "Creating window...\n"; WNDCLASS wc = {}; wc.lpfnWndProc = WindowProc; wc.hInstance = hInstance; wc.lpszClassName = CLASS_NAME; RegisterClass(&wc); // Create the window. HWND hwnd = CreateWindowEx( 0, CLASS_NAME, "RDFT Engine Demo", WS_OVERLAPPEDWINDOW, 20, 20, 1024, 768, NULL, NULL, hInstance, NULL); if (hwnd == NULL) return 0; ShowWindow(hwnd, nCmdShow); std::cout << "Initializing Engine...\n"; Engine()->SetHWND(hwnd); std::cout << "Loading libraries...\n"; if (!Engine()->LoadDLLs()) return 0; std::cout << "Creating devices...\n"; if (!Engine()->CreateDevices()) return 0; std::cout << "Setting up devices...\n"; Engine()->GetGlDevice()->SetWindowSize(); // This will call the constructors for our singletons std::cout << "Creating game...\n"; MG(); std::cout << "Setup complete!\n"; Con()->Start(); // Run the message loop. MSG msg = {}; bool done = false; while (!done) { PeekMessage(&msg, NULL, NULL, NULL, PM_REMOVE); if (msg.message == WM_QUIT) { done = true; } else { TranslateMessage(&msg); DispatchMessage(&msg); } MG()->Think(); MG()->Draw(); Con()->ExecSync(); } Con()->Stop(); return 0; }