int main() { // 2 1 3 ListNode l1(2), l2(1), l3(3); ListNode l4(4), l5(2), l6(1), l7(6), l8(6), l9(9), l10(10), l11(11), l12(12), l13(6); ListNode n1(0), n2(0), n3(0), n4(1); l1.next = &l2; //l2.next = &l3; l4.next = &l5; l5.next = &l6; l6.next = &l7; l7.next = &l8; l8.next = &l9; l9.next = &l10; l10.next = &l11; l11.next = &l12; l12.next = &l13; print_list(&l1); Solution s; ListNode *result = s.removeNthFromEnd(&l1, 2); print_list(result); return 0; }
// // Save // ==== // // Save the information for this object to the AuditDataFile // bool CLocaleScanner::SaveData (CAuditDataFile* pAuditDataFile) { CLogFile log; log.Write("CLocaleScanner::SaveData Start" ,true); CString strValue; // Add the Category for memory CAuditDataFileCategory category(HARDWARE_CLASS); // Each audited item gets added an a CAuditDataFileItem to the category CAuditDataFileItem l1(V_LOCALE_CODEPAGE ,m_iCodePage); CAuditDataFileItem l2(V_LOCALE_CALENDARTYPE ,m_strCalendarType); CAuditDataFileItem l3(V_LOCALE_COUNTRY ,m_strCountry); CAuditDataFileItem l4(V_LOCALE_COUNTRYCODE ,m_iCountryCode); CAuditDataFileItem l5(V_LOCALE_CURRENCY ,m_strCurrency); CAuditDataFileItem l6(V_LOCALE_DATEFORMAT ,m_strDateFormat); CAuditDataFileItem l7(V_LOCALE_LANGUAGE ,m_strLanguage); CAuditDataFileItem l8(V_LOCALE_LOCALLANGUAGE ,m_strLocaleLocalLanguage); CAuditDataFileItem l9(V_LOCALE_OEM_CODEPAGE ,m_iOEMCodePage); CAuditDataFileItem l10(V_LOCALE_TIMEFORMAT ,m_strTimeFormat); CAuditDataFileItem l11(V_LOCALE_TIMEFORMATSPECIFIER ,m_strTimeFormatSpecifier); CAuditDataFileItem l12(V_LOCALE_TIMEZONE ,m_strLocaleTimeZone); // Add the items to the category category.AddItem(l1); category.AddItem(l2); category.AddItem(l3); category.AddItem(l4); category.AddItem(l5); category.AddItem(l6); category.AddItem(l7); category.AddItem(l8); category.AddItem(l9); category.AddItem(l10); category.AddItem(l11); category.AddItem(l12); // ...and add the category to the AuditDataFile pAuditDataFile->AddAuditDataFileItem(category); // we always need to get the default browser details so do here CAuditDataFileCategory browserCategory("Internet|Browsers|Default Browser", FALSE, TRUE); CAuditDataFileItem b1("Path", GetRegValue("HKEY_CLASSES_ROOT\\http\\shell\\open\\command", "")); browserCategory.AddItem(b1); pAuditDataFile->AddInternetItem(browserCategory); log.Write("CLocaleScanner::SaveData End" ,true); return true; }
int main(void) { size_t size; uint64_t *primes = primesieve_generate_primes(5, MAX + 100, &size, UINT64_PRIMES); if(!primes) { puts("Could not allocate primes."); return 1; } uint64_t s = 0; for(uint64_t i = 0, p1, p2, t;; ++i) { p1 = primes[i]; if(p1 > MAX) { break; } p2 = primes[i + 1]; t = l10(p1); s += p2*moddiv(p1, p2, t); } primesieve_free(primes); printf("%"PRIu64"\n", s); }
void apply(osg::Group& group) { if (s_ExitApplication) return; osgTerrain::TerrainTile* terrainTile = dynamic_cast<osgTerrain::TerrainTile*>(&group); osgTerrain::Locator* locator = terrainTile ? terrainTile->getLocator() : 0; if (locator) { osg::Vec3d l00(0.0,0.0,0.0); osg::Vec3d l10(1.0,0.0,0.0); osg::Vec3d l11(1.0,1.0,0.0); osg::Vec3d l01(0.0,1.0,0.0); osg::Vec3d w00, w10, w11, w01; locator->convertLocalToModel(l00, w00); locator->convertLocalToModel(l10, w10); locator->convertLocalToModel(l11, w11); locator->convertLocalToModel(l01, w01); if (locator->getEllipsoidModel() && locator->getCoordinateSystemType()==osgTerrain::Locator::GEOCENTRIC) { convertXYZToLatLongHeight(locator->getEllipsoidModel(), w00); convertXYZToLatLongHeight(locator->getEllipsoidModel(), w10); convertXYZToLatLongHeight(locator->getEllipsoidModel(), w11); convertXYZToLatLongHeight(locator->getEllipsoidModel(), w01); } updateBound(w00); updateBound(w10); updateBound(w11); updateBound(w01); return; } traverse(group); }
static double lobatto_fn_10(double x) { return l10(x); }
static double lob10(double x) { return l10(x); }