跳到正文

剪贴板

剪贴板 0k3h41o9

原文
剪贴板信息

剪贴板信息

收录
更新

实用的东西

好网站

QX题解索引

QX杂记索引

C++手册

Latex教程

OI—WIKI

Vjudge(所有oj的每个题都有)

工具箱

玩转你的线段树样例

云剪贴板保存站:把原网址的.com.cn 改成 .me

应正确使用运算符,(+,−,±,×,⋅,÷,≤,≥,∣+, -, \pm, \times, \cdot, \div, \le, \ge, \mid):+, -, \pm, \times, \cdot, \div, \le, \ge, \mid。

对拍程序示例

C++
#include<bits/stdc++.h>
#include <iostream>
const int mod = 200000,mod2=1e9+7,u=4;
using namespace std;

int main() {
	//对拍:以P7497“四方喝彩”为随机数据生成器标准。
	srand(time(0));
	int u=4;
	int n= rand() * RAND_MAX + rand();
	int m= rand() * RAND_MAX + rand();
	n%=mod,m%=mod;
	freopen("test.in","w",stdout);
	cout<<n<<" "<<m<<"\n";
	while(n--){
		int l= rand() * RAND_MAX + rand();
		l%=mod2;
		cout<<l<<" ";
	}
	cout<<endl;
	while(m--){
		int p=rand();
		p%=u,p+=1;
		cout<<p<<" ";
	    int l= rand() * RAND_MAX + rand();
	    int r= l + rand() * RAND_MAX + rand();
	    int x= rand() * RAND_MAX + rand();
	    l%=mod,r%=mod,x%=mod2;
	    cout<<l<<" "<<r<<" ";
	    if(p<=3)cout<<x;
	    cout<<endl;
	}
    while (true) {
        // 数据生成器将生成数据写入输入文件
        system("test1.exe < test.in > a.out");  // 获取程序1输出
        system("test2.exe < test.in > b.out");  // 获取程序2输出
        if (system("fc a.out b.out")) {
                // 该行语句比对输入输出
                // fc返回0时表示输出一致,否则表示有不同处
                system("pause");  // 方便查看不同处
                return 0;
                // 该输入数据已经存放在test.in文件中,可以直接利用进行调试
    }
  }
}

自动转换题解格式:

C++
#include <iostream>
#include <string>
#include <regex>
#include <unordered_map>
using namespace std;

unordered_map<char, string> punct_map = {
    {',', ","}, {'.', "。"}, {'!', "!"}, {'?', "?"},
    {';', ";"}, {':', ":"}, {'(', "("}, {')', ")"}
};

// 处理中英文间距和标点
string format_spaces_punct(const string& text) {
    string result = text;

    // 替换半角标点为全角
    for (auto& p : punct_map) {
        size_t pos = 0;
        while ((pos = result.find(p.first, pos)) != string::npos) {
            result.replace(pos, 1, p.second);
            pos += p.second.length();
        }
    }

    // 确保句末有句号
    if (!result.empty() && result.back() != '。' && result.back() != '!' && result.back() != '?') {
        result += "。";
    }
    return result;
}

// 代码块格式化
string format_code(const string& text) {
    regex code_re(R"(```.*?\n(.*?)\n```)", regex::icase);
    return regex_replace(text, code_re, "```cpp\n$1\n```");
}

string format_list(const string& text) {
    // 匹配 * 或 1. 开头的列表项
    regex list_re(R"((^|\n)(\s*)([*\-+]|\d+\.)\s+)");
    return regex_replace(text, list_re, "$1$2- ");
}

// 新增标题层级控制
string format_headers(const string& text) {
    // 限制标题最多三级
    regex h1_re(R"(^#{4,}\s)");
    string s = regex_replace(text, h1_re, "### ");
    regex h2_re(R"(^#{3}(\s))");
    return regex_replace(s, h2_re, "###$1");
}

// 新增超链接处理
string format_links(const string& text) {
    // 转换裸链接为 Markdown 格式
    regex url_re(R"((https?://\S+)(?=\s|$))");
    return regex_replace(text, url_re, "[链接]($1)");
}

// 增强数学公式处理
string format_math(const string& text) {
    string s = text;

    // 1. 转换中文括号为英文括号
    regex cn_paren_re(R"([(]([^)]*)[)])");
    s = regex_replace(s, cn_paren_re, "($1)");

    // 2. 处理没有汉字的字符串(纯公式)
    regex no_chinese_re(R"([\u4e00-\u9fa5]?([^\u4e00-\u9fa5]+?)(?=[\u4e00-\u9fa5]|$))");
    s = regex_replace(s, no_chinese_re, "$$$1$$ ");

    // 3. 处理公式与汉字相邻的情况
    regex chinese_math_re(R"(([\u4e00-\u9fa5])\s*(\$\$[^\$]+\$\$))");
    s = regex_replace(s, chinese_math_re, "$1 $2");

    regex math_chinese_re(R"((\$\$[^\$]+\$\$)\s*([\u4e00-\u9fa5]))");
    s = regex_replace(s, math_chinese_re, "$1 $2");

    // 4. 清理多余空格
    regex extra_space_re(R"(\s{2,})");
    s = regex_replace(s, extra_space_re, " ");

    return s;
}

// 新增段落空行控制
string format_paragraphs(const string& text) {
    regex empty_line_re(R"(\n{3,})");
    return regex_replace(text, empty_line_re, "\n\n");
}

int main() {
    while(true) {
        string input, line;
        cout << "请输入文本(空行结束输入):\n";
        input = "";
        while (getline(cin, line) && !line.empty()) {
            input += line + "\n";
        }

        if (input.empty()) break;

        string output = input;
        output = format_spaces_punct(output);
        output = format_math(output);
        output = format_code(output);
        output = format_links(output);
        output = format_headers(output);
        output = format_list(output);
        output = format_paragraphs(output);

        cout << "\n处理结果:\n" << output << "\n\n";
    }
    return 0;
}










#include <iostream>
#include <string>
#include <regex>
#include <unordered_map>
using namespace std;

unordered_map<char, string> punct_map = {  // 现在可以识别 unordered_map 类型
	{',', ","}, {'.', "。"}, {'!', "!"}, {'?', "?"},
	{';', ";"}, {':', ":"}, {'(', "("}, {')', ")"}
};

// 处理中英文间距和标点
string format_spaces_punct(const string& text) {
	string result;
	regex space_re(R"(([\u4e00-\u9fa5])([a-zA-Z0-9$])|([a-zA-Z0-9$])([\u4e00-\u9fa5]))");
	result = regex_replace(text, space_re, "$1$3 $2$4"); // 插入空格

	// 替换半角标点为全角
	for (char c : result) {
		if (punct_map.count(c)) result.replace(result.find(c), 1, punct_map[c]);
	}

	// 确保句末有句号
	if (result.back() != '。' && result.back() != '!' && result.back() != '?')
		result += "。";
	return result;
}

// 代码块格式化
string format_code(const string& text) {
	regex code_re(R"(```.*?\n(.*?)\n```)", regex::icase);
	return regex_replace(text, code_re, "```cpp\n$1\n```");
}

string format_list(const string& text) {
	// 匹配 * 或 1. 开头的列表项
	regex list_re(R"((^|\n)(\s*)([*\-+]|\d+\.)\s+)");
	return regex_replace(text, list_re, "$1$2- ");
}

// 新增标题层级控制
string format_headers(const string& text) {
	// 限制标题最多三级
	regex h1_re(R"(^#{4,}\s)");
	string s = regex_replace(text, h1_re, "### ");
	regex h2_re(R"(^#{3}(\s))");
	return regex_replace(s, h2_re, "###$1");
}

// 新增超链接处理
string format_links(const string& text) {
	// 转换裸链接为 Markdown 格式
	regex url_re(R"((https?://\S+)(?=\s|$))");
	return regex_replace(text, url_re, "[链接]($1)");
}

// 增强数学公式处理
string format_math(const string& text) {
	// 合并多行公式、单行变量、运算符处理
	string s = text;
	s = regex_replace(s, regex(R"(\n\s*(\$\$)\n((?:.*\n)*?)\s*\1\n)"), "\n$$$$\n$2$$$$\n");
	s = regex_replace(s, regex(R"(\b([a-zA-Z_]\w*)\b(?![^{]*}))"), "$$$1$$");
	s = regex_replace(s, regex(R"((\+|-|\*|/|=|<>|<=|>=))"), " $1 ");
	return s;
}

// 新增段落空行控制
string format_paragraphs(const string& text) {
	regex empty_line_re(R"(\n{3,})");
	return regex_replace(text, empty_line_re, "\n\n");
}

int main() {
	while(1) {
		string input, line;
		while (getline(cin, line) && !line.empty())
			input += line + "\n";

		string output = format_spaces_punct(input);
		output = format_math(output);
		output = format_code(output);
		output = format_links(output);
		output = format_headers(output);
		output = format_list(output);
		output = format_paragraphs(output);

		cout << "\n \n" << output;
	}
	return 0;
}

一键删犇犇:F12,在控制台(console)输入

C++
$.get("/paste/0i6e21mf?_contentOnly",d=>eval(d.currentData.paste.data))

查看博客md代码:F12,在控制台输入

C++
fetch('/api/blog/detail/' + BlogGlobals.blogID).then(res => res.json()).then(res => console.log(res.data.Content))

查看主页md代码:F12,在控制台输入

C++
console.log(_feInstance.currentData.user.introduction)

查看比赛主页md代码:F12,在控制台输入

C++
console.log(_feInstance.currentData.contest.description)

e:

C++
2.7182818284590452353602874713526624977572470936999595749669676277240766303535475945713821785251664274274663919320030599218174135966290435729003342952605956307381323286279434907632338298807531952510190115738341879307021540891499348841675092447614606680822648001684774118537423454424371075390777449920695517027618386062613313845830007520449338265602976067371132007093287091274437470472306969772093101416928368190255151086574637721112523897844250569536967707854499699679468644549059879316368892300987931277361782154249992295763514822082698951936680331825288693984964651058209392398294887933203625094431173012381970684161403970198376793206832823764648042953118023287825098194558153017567173613320698112509961818815930416903515988885193458072738667385894228792284998920868058257492796104841984443634632449684875602336248270419786232090021609902353043699418491463140934317381436405462531520961836908887070167683964243781405927145635490613031072085103837505101157477041718986106873969655212671546889570350354021234078498193343210681701210056278802351930332247450158539047304199577770935036604169973297250886876966403555707162268447162560798826517871341951246652010305921236677194325278675398558944896970964097545918569563802363701621120477427228364896134225164450781824423529486363721417402388934412479635743702637552944483379980161254922785092577825620926226483262779333865664816277251640191059004916449982893150566047258027786318641551956532442586982946959308019152987211725563475463964479101459040905862984967912874068705048958586717479854667757573205681288459205413340539220001137863009455606881667400169842055804033637953764520304024322566135278369511778838638744396625322498506549958862342818997077332761717839280349465014345588970719425863987727547109629537415211151368350627526023264847287039207643100595841166120545297030236472549296669381151373227536450988890313602057248176585118063036442812314965507047510254465011727211555194866850800368532281831521960037356252794495158284188294787610852639813955990067376482922443752871846245780361929819713991475644882626039033814418232625150974827987779964373089970388867782271383605772978824125611907176639465070633045279546618550966661856647097113444740160704626215680717481877844371436988218559670959102596862002353718588748569652200050311734392073211390803293634479727355955277349071783793421637012050054513263835440001863239914907054797780566978533580489669062951194324730995876552368128590413832411607226029983305353708761389396391779574540161372236187893652605381558415871869255386061647798340254351284396129460352913325942794904337299085731580290958631382683291477116396337092400316894586360606458459251269946557248391865642097526850823075442545993769170419777800853627309417101634349076964237222943523661255725088147792231519747780605696725380171807763603462459278778465850656050780844211529697521890874019660906651803516501792504619501366585436632712549639908549144200014574760819302212066024330096412704894390397177195180699086998606636583232278709376502260149291011517177635944602023249300280401867723910288097866605651183260043688508817157238669842242201024950551881694803221002515426494639812873677658927688163598312477886520141174110913601164995076629077943646005851941998560162647907615321038727557126992518275687989302761761146162549356495903798045838182323368612016243736569846703785853305275833337939907521660692380533698879565137285593883499894707416181550125397064648171946708348197214488898790676503795903669672494992545279033729636162658976039498576741397359441023744329709355477982629614591442936451428617158587339746791897571211956187385783644758448423555581050025611492391518893099463428413936080383091662818811503715284967059741625628236092168075150177725387402564253470879089137291722828611515915683725241630772254406337875931059826760944203261924285317018781772960235413060672136046000389661093647095141417185777014180606443636815464440053316087783143174440811949422975599314011888683314832802706553833004693290115744147563139997221703804617092894579096271662260740718749975359212756084414737823303270330168237193648002173285734935947564334129943024850235732214597843282641421684878721673367010615094243456984401873312810107945127223737886126058165668053714396127888732527373890392890506865324138062796025930387727697783792868409325365880733988457218746021005311483351323850047827169376218004904795597959290591655470505777514308175112698985188408718564026035305583737832422924185625644255022672155980274012617971928047139600689163828665277009752767069777036439260224372841840883251848770472638440379530166905465937461619323840363893131364327137688841026811219891275223056256756254701725086349765367288605966752740868627407912856576996313789753034660616669804218267724560530660773899624218340859882071864682623215080288286359746839654358856685503773131296587975810501214916207656769950659715344763470320853215603674828608378656803073062657633469774295634643716709397193060876963495328846833613038829431040800296873869117066666146800015121143442256023874474325250769387077775193299942137277211258843608715834835626961661980572526612206797540621062080649882918454395301529982092503005498257043390553570168653120526495614857249257386206917403695213533732531666345466588597286659451136441370331393672118569553952108458407244323835586063106806964924851232632699514603596037297253198368423363904632136710116192821711150282801604488058802382031981493096369596735832742024988245684941273860566491352526706046234450549227581151709314921879592718001940968866986837037302200475314338181092708030017205935530520700706072233999463990571311587099635777359027196285061146514837526209565346713290025994397663114545902685898979115837093419370441155121920117164880566945938131183843765620627846310490346293950029458341164824114969758326011800731699437393506966295712410273239138741754923071862454543222039552735295240245903805744502892246886285336542213815722131163288112052146489805180092024719391710555390113943316681515828843687606961102505171007392762385553386272553538830960671644662370922646809671254061869502143176211668140097595281493907222601112681153108387317617323235263605838173151034595736538223534992935822836851007810884634349983518404451704270189381994243410090575376257767571118090088164183319201962623416288166521374717325477727783488774366518828752156685719506371936565390389449366421764003121527870222366463635755503565576948886549500270853923617105502131147413744106134445544192101336172996285694899193369184729478580729156088510396781959429833186480756083679551496636448965592948187851784038773326247051945050419847742014183947731202815886845707290544057510601285258056594703046836344592652552137008068752009593453607316226118728173928074623094685367823106097921599360019946237993434210687813497346959246469752506246958616909178573976595199392993995567542714654910456860702099012606818704984178079173924071945996323060254707901774527513186809982284730860766536866855516467702911336827563107223346726113705490795365834538637196235856312618387156774118738527722922594743373785695538456246801013905727871016512966636764451872465653730402443684140814488732957847348490003019477888020460324660842875351848364959195082888323206522128104190448047247949291342284951970022601310430062410717971502793433263407995960531446053230488528972917659876016667811937932372453857209607582277178483361613582612896226118129455927462767137794487586753657544861407611931125958512655759734573015333642630767985443385761715333462325270572005303988289499034259566232975782488735029259166825894456894655992658454762694528780516501720674785417887982276806536650641910973434528878338621726156269582654478205672987756426325321594294418039943217000090542650763095588465895171709147607437136893319469090981904501290307099566226620303182649365733698419555776963787624918852865686607600566025605445711337286840205574416030837052312242587223438854123179481388550075689381124935386318635287083799845692619981794523364087429591180747453419551420351726184200845509170845682368200897739455842679214273477560879644279202708312150156406341341617166448069815483764491573900121217041547872591998943825364950514771379399147205219529079396137621107238494290616357604596231253506068537651423115349665683715116604220796394466621163255157729070978473156278277598788136491951257483328793771571459091064841642678309949723674420175862269402159407924480541255360431317992696739157542419296607312393763542139230617876753958711436104089409966089471418340698362993675362621545247298464213752891079884381306095552622720837518629837066787224430195793793786072107254277289071732854874374355781966511716618330881129120245204048682200072344035025448202834254187884653602591506445271657700044521097735585897622655484941621714989532383421600114062950718490427789258552743035221396835679018076406042138307308774460170842688272261177180842664333651780002171903449234264266292261456004337383868335555343453004264818473989215627086095650629340405264943244261445665921291225648893569655009154306426134252668472594914314239398845432486327461842846655985332312210466259890141712103446084271616619001257195870793217569698544013397622096749454185407118446433946990162698351607848924514058940946395267807354579700307051163682519487701189764002827648414160587206184185297189154019688253289309149665345753571427318482016384644832499037886069008072709327673127581966563941148961716832980455139729506687604740915420428429993541025829113502241690769431668574242522509026939034814856451303069925199590436384028429267412573422447765584177886171737265462085498294498946787350929581652632072258992368768457017823038096567883112289305809140572610865884845873101658151167533327674887014829167419701512559782572707406431808601428149024146780472327597684269633935773542930186739439716388611764209004068663398856841681003872389214483176070116684503887212364367043314091155733280182977988736590916659612402021778558854876176161989370794380056663364884365089144805571039765214696027662583599051987042300179465536788

π:

C++
3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348253421170679821480865132823066470938446095505822317253594081284811174502841027019385211055596446229489549303819644288109756659334461284756482337867831652712019091456485669234603486104543266482133936072602491412737245870066063155881748815209209628292540917153643678925903600113305305488204665213841469519415116094330572703657595919530921861173819326117931051185480744623799627495673518857527248912279381830119491298336733624406566430860213949463952247371907021798609437027705392171762931767523846748184676694051320005681271452635608277857713427577896091736371787214684409012249534301465495853710507922796892589235420199561121290219608640344181598136297747713099605187072113499999983729780499510597317328160963185950244594553469083026425223082533446850352619311881710100031378387528865875332083814206171776691473035982534904287554687311595628638823537875937519577818577805321712268066130019278766111959092164201989380952572010654858632788659361533818279682303019520353018529689957736225994138912497217752834791315155748572424541506959508295331168617278558890750983817546374649393192550604009277016711390098488240128583616035637076601047101819429555961989467678374494482553797747268471040475346462080466842590694912933136770289891521047521620569660240580381501935112533824300355876402474964732639141992726042699227967823547816360093417216412199245863150302861829745557067498385054945885869269956909272107975093029553211653449872027559602364806654991198818347977535663698074265425278625518184175746728909777727938000816470600161452491921732172147723501414419735685481613611573525521334757418494684385233239073941433345477624168625189835694855620992192221842725502542568876717904946016534668049886272327917860857843838279679766814541009538837863609506800642251252051173929848960841284886269456042419652850222106611863067442786220391949450471237137869609563643719172874677646575739624138908658326459958133904780275900994657640789512694683983525957098258226205224894077267194782684826014769909026401363944374553050682034962524517493996514314298091906592509372216964615157098583874105978859597729754989301617539284681382686838689427741559918559252459539594310499725246808459872736446958486538367362226260991246080512438843904512441365497627807977156914359977001296160894416948685558484063534220722258284886481584560285060168427394522674676788952521385225499546667278239864565961163548862305774564980355936345681743241125150760694794510965960940252288797108931456691368672287489405601015033086179286809208747609178249385890097149096759852613655497818931297848216829989487226588048575640142704775551323796414515237462343645428584447952658678210511413547357395231134271661021359695362314429524849371871101457654035902799344037420073105785390621983874478084784896833214457138687519435064302184531910484810053706146806749192781911979399520614196634287544406437451237181921799983910159195618146751426912397489409071864942319615679452080951465502252316038819301420937621378559566389377870830390697920773467221825625996615014215030680384477345492026054146659252014974428507325186660021324340881907104863317346496514539057962685610055081066587969981635747363840525714591028970641401109712062804390397595156771577004203378699360072305587631763594218731251471205329281918261861258673215791984148488291644706095752706957220917567116722910981690915280173506712748583222871835209353965725121083579151369882091444210067510334671103141267111369908658516398315019701651511685171437657618351556508849099898599823873455283316355076479185358932261854896321329330898570642046752590709154814165498594616371802709819943099244889575712828905923233260972997120844335732654893823911932597463667305836041428138830320382490375898524374417029132765618093773444030707469211201913020330380197621101100449293215160842444859637669838952286847831235526582131449576857262433441893039686426243410773226978028073189154411010446823252716201052652272111660396665573092547110557853763466820653109896526918620564769312570586356620185581007293606598764861179104533488503461136576867532494416680396265797877185560845529654126654085306143444318586769751456614068007002378776591344017127494704205622305389945613140711270004078547332699390814546646458807972708266830634328587856983052358089330657574067954571637752542021149557615814002501262285941302164715509792592309907965473761255176567513575178296664547791745011299614890304639947132962107340437518957359614589019389713111790429782856475032031986915140287080859904801094121472213179476477726224142548545403321571853061422881375850430633217518297986622371721591607716692547487389866549494501146540628433663937900397692656721463853067360965712091807638327166416274888800786925602902284721040317211860820419000422966171196377921337575114959501566049631862947265473642523081770367515906735023507283540567040386743513622224771589150495309844489333096340878076932599397805419341447377441842631298608099888687413260472156951623965864573021631598193195167353812974167729478672422924654366800980676928238280689964004824354037014163149658979409243237896907069779422362508221688957383798623001593776471651228935786015881617557829735233446042815126272037343146531977774160319906655418763979293344195215413418994854447345673831624993419131814809277771038638773431772075456545322077709212019051660962804909263601975988281613323166636528619326686336062735676303544776280350450777235547105859548702790814356240145171806246436267945612753181340783303362542327839449753824372058353114771199260638133467768796959703098339130771098704085913374641442822772634659470474587847787201927715280731767907707157213444730605700733492436931138350493163128404251219256517980694113528013147013047816437885185290928545201165839341965621349143415956258658655705526904965209858033850722426482939728584783163057777560688876446248246857926039535277348030480290058760758251047470916439613626760449256274204208320856611906254543372131535958450687724602901618766795240616342522577195429162991930645537799140373404328752628889639958794757291746426357455254079091451357111369410911939325191076020825202618798531887705842972591677813149699009019211697173727847684726860849003377024242916513005005168323364350389517029893922334517220138128069650117844087451960121228599371623130171144484640903890644954440061986907548516026327505298349187407866808818338510228334508504860825039302133219715518430635455007668282949304137765527939751754613953984683393638304746119966538581538420568533862186725233402830871123282789212507712629463229563989898935821167456270102183564622013496715188190973038119800497340723961036854066431939509790190699639552453005450580685501956730229219139339185680344903982059551002263535361920419947455385938102343955449597783779023742161727111723643435439478221818528624085140066604433258885698670543154706965747458550332323342107301545940516553790686627333799585115625784322988273723198987571415957811196358330059408730681216028764962867446047746491599505497374256269010490377819868359381465741268049256487985561453723478673303904688383436346553794986419270563872931748723320837601123029911367938627089438799362016295154133714248928307220126901475466847653576164773794675200490757155527819653621323926406160136358155907422020203187277605277219005561484255518792530343513984425322341576233610642506390497500865627109535919465897514131034822769306247435363256916078154781811528436679570611086153315044521274739245449454236828860613408414863776700961207151249140430272538607648236341433462351897576645216413767969031495019108575984423919862916421939949072362346468441173940326591840443780513338945257423995082965912285085558215725031071257012668302402929525220118726767562204154205161841634847565169998116141010029960783869092916030288400269104140792886215078424516709087000699282120660418371806535567252532567532861291042487761825829765157959847035622262934860034158722980534989650226291748788202734209222245339856264766914905562842503912757710284027998066365825488926488025456610172967026640765590429099456815065265305371829412703369313785178609040708667114965583434347693385781711386455873678123014587687126603489139095620099393610310291616152881384379099042317473363948045759314931405297634757481193567091101377517210080315590248530906692037671922033229094334676851422144773793937517034436619910403375111735471918550464490263655128162288244625759163330391072253837421821408835086573917715096828874782656995995744906617583441375223970968340800535598491754173818839994469748676265516582765848358845314277568790029095170283529716344562129640435231176006651012412006597558512761785838292041974844236080071930457618932349229279650198751872127267507981255470958904556357921221033346697499235630254947802490114195212382815309114079073860251522742995818072471625916685451333123948049470791191532673430282441860414263639548000448002670496248201792896476697583183271314251702969234889627668440323260927524960357996469256504936818360900323809293459588970695365349406034021665443755890045632882250545255640564482465151875471196218443965825337543885690941130315095261793780029741207665147939425902989695946995565761218656196733786236256125216320862869222103274889218654364802296780705765615144632046927906821207388377814233562823608963208068222468012248261177185896381409183903673672220888321513755600372798394004152970028783076670944474560134556417254370906979396122571429894671543578468788614445812314593571984922528471605049221242470141214780573455105008019086996033027634787081081754501193071412233908663938339529425786905076431006383519834389341596131854347546495569781038293097164651438407007073604112373599843452251610507027056235266012764848308407611830130527932054274628654036036745328651057065874882256981579367897669742205750596834408697350201410206723585020072452256326513410559240190274216248439140359989535394590944070469120914093870012645600162374288021092764579310657922955249887275846101264836999892256959688159205600101655256375678

C++优化:

C++
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3)
#pragma comment(linker,"/stack:200000000")
#pragma GCC optimize("Ofast,no-stack-protector")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("inline")
#pragma GCC optimize("-fgcse")
#pragma GCC optimize("-fgcse-lm")
#pragma GCC optimize("-fipa-sra")
#pragma GCC optimize("-ftree-pre")
#pragma GCC optimize("-ftree-vrp")
#pragma GCC optimize("-fpeephole2")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-fsched-spec")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("-falign-jumps")
#pragma GCC optimize("-falign-loops")
#pragma GCC optimize("-falign-labels")
#pragma GCC optimize("-fdevirtualize")
#pragma GCC optimize("-fcaller-saves")
#pragma GCC optimize("-fcrossjumping")
#pragma GCC optimize("-fthread-jumps")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-fwhole-program")
#pragma GCC optimize("-freorder-blocks")
#pragma GCC optimize("-fschedule-insns")
#pragma GCC optimize("inline-functions")
#pragma GCC optimize("-ftree-tail-merge")
#pragma GCC optimize("-fschedule-insns2")
#pragma GCC optimize("-fstrict-aliasing")
#pragma GCC optimize("-fstrict-overflow")
#pragma GCC optimize("-falign-functions")
#pragma GCC optimize("-fcse-skip-blocks")
#pragma GCC optimize("-fcse-follow-jumps")
#pragma GCC optimize("-fsched-interblock")
#pragma GCC optimize("-fpartial-inlining")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("-freorder-functions")
#pragma GCC optimize("-findirect-inlining")
#pragma GCC optimize("-fhoist-adjacent-loads")
#pragma GCC optimize("-frerun-cse-after-loop")
#pragma GCC optimize("inline-small-functions")
#pragma GCC optimize("-finline-small-functions")
#pragma GCC optimize("-ftree-switch-conversion")
#pragma GCC optimize("-foptimize-sibling-calls")
#pragma GCC optimize("-fexpensive-optimizations")
#pragma GCC optimize("-funsafe-loop-optimizations")
#pragma GCC optimize("inline-functions-called-once")
#pragma GCC optimize("-fdelete-null-pointer-checks")
#pragma GCC optimize("-fdelete-null-pointer-checks,inline-functions-called-once,-funsafe-loop-optimizations,-fexpensive-optimizations,-foptimize-sibling-calls,-ftree-switch-conversion,-finline-small-functions,inline-small-functions,-frerun-cse-after-loop,-fhoist-adjacent-loads,-findirect-inlining,-freorder-functions,no-stack-protector,-fpartial-inlining,-fsched-interblock,-fcse-follow-jumps,-fcse-skip-blocks,-falign-functions,-fstrict-overflow,-fstrict-aliasing,-fschedule-insns2,-ftree-tail-merge,inline-functions,-fschedule-insns,-freorder-blocks,-fwhole-program,-funroll-loops,-fthread-jumps,-fcrossjumping,-fcaller-saves,-fdevirtualize,-falign-labels,-falign-loops,-falign-jumps,unroll-loops,-fsched-spec,-ffast-math,Ofast,inline,-fgcse,-fgcse-lm,-fipa-sra,-ftree-pre,-ftree-vrp,-fpeephole2",3)

cin&&cout加速:

C++
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);



或



ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);

文件输入:

C++
freopen("XXX.in","r",stdin);

文件输出:

C++
freopen("XXX.out","w",stdout);

随机数

C++
#include <bits/stdc++.h>
using namespace std;
int main(){
	srand(time(0));
	int a=rand();
	cout<<a;
}

快读快写

1(常用)
C++
int read(){
	int x=0,y=0;char c=0;
	while(!isdigit(c))y|=c=='-',c=getchar();
	while(isdigit(c))x=(x<<3)+(x<<1)+(c^48),c=getchar();
  /*
  isdigit(c) 查询字符 c 是否为数字。
  (x<<3)+(x<<1) 其实就是 x*10
  y|=c=='-' 表示询问 c 是否为 '-'
  */
	return y?-x:x;
 }
 void solve(){
	//don't forget to open long long
	int n=read();ll ans=0;
	while(n--){
		int x=read();
		ans+=x;
	}
	std::cout<<ans<<'\n';
}



 或



inline long long read() {
	int k=0,f=1;
	char c=getchar();
	while(c<'0' || c>'9') {
		if(c=='-')f=-1;
		c=getchar();
	}
	while(c>='0' && c<='9') {
		k*=10;
		k+=c-'0';
		c=getchar();
	}
	return k*f;
}
2(不常用)
C++
#include<bits/stdc++.h>
using namespace std;
namespace Fast_I{
	char *_Buf,*_Start_ptr,*_End_ptr;
	std::streambuf*inbuf;
	unsigned int Size;
	bool _Ok;
	struct Fast_Istream{
		operator bool(){
			return _Ok;
		}
		Fast_Istream(std::streambuf*,unsigned int);
		Fast_Istream(unsigned int);
		Fast_Istream(const char*,unsigned int);
		Fast_Istream&operator>>(char&);
		Fast_Istream&operator>>(char*);
		Fast_Istream&operator>>(bool&);
		Fast_Istream&operator>>(short&);
		Fast_Istream&operator>>(int&);
		Fast_Istream&operator>>(long&);
		Fast_Istream&operator>>(long long&);
		Fast_Istream&operator>>(unsigned short&);
		Fast_Istream&operator>>(unsigned int&);
		Fast_Istream&operator>>(unsigned long&);
		Fast_Istream&operator>>(unsigned long long&);
		Fast_Istream&operator>>(float&);
		Fast_Istream&operator>>(double&);
		Fast_Istream&operator>>(long double&);
		Fast_Istream&operator>>(std::string&);
		template<typename Typex>
		void operator()(Typex&_Val){
			*this>>_Val;
		}
		template<typename Typex,typename...More>
		void operator()(Typex&,More&...);
		std::streambuf*rdbuf(){
			return inbuf;
		}
		void rdbuf(std::streambuf*_inbuf){
			inbuf=_inbuf;
		}
		void rdbuf(const char*);
		void pop();
		char peek();
	};
}
namespace Fast_O{
	std::string buf;
	std::streambuf*outbuf;
	struct Fast_Ostream{
		Fast_Ostream(std::streambuf*,unsigned int);
		Fast_Ostream(std::streambuf*out){
			outbuf=out;
		}
		Fast_Ostream(const char*,unsigned int);
		Fast_Ostream(unsigned int);
		void flush();
		~Fast_Ostream();
		void endl(){
			buf.push_back('\n');
		}
		template<typename Typex>
		void endl(const Typex&_Val);
		template<typename Typex,typename...More>
		void endl(const Typex&,const More&...);
		template<typename Typex>
		void operator()(const Typex&_Val);
		template<typename Typex,typename...More>
		void operator()(const Typex&,const More&...);
		Fast_Ostream&operator<<(char);
		Fast_Ostream&operator<<(const char*);
		Fast_Ostream&operator<<(const std::string&);
		Fast_Ostream&operator<<(bool);
		Fast_Ostream&operator<<(short);
		Fast_Ostream&operator<<(int);
		Fast_Ostream&operator<<(long);
		Fast_Ostream&operator<<(long long);
		Fast_Ostream&operator<<(unsigned short);
		Fast_Ostream&operator<<(unsigned int);
		Fast_Ostream&operator<<(unsigned long);
		Fast_Ostream&operator<<(unsigned long long);
		std::streambuf*rdbuf(){
			return outbuf;
		}
		void rdbuf(std::streambuf*_outbuf){
			outbuf=_outbuf;
		}
		void rdbuf(const char*);
	};
}
namespace Fast_IO{
	Fast_I::Fast_Istream fin(std::cin.rdbuf(),1048576);
	Fast_O::Fast_Ostream fout(std::cout.rdbuf());
}
#define cin Fast_IO::fin
#define cout Fast_IO::fout
#define int long long
signed main(){
	return 0;
}
#undef int
namespace Fast_I{
	Fast_Istream::Fast_Istream(std::streambuf*in,unsigned int Sz){
		_Ok=1;
		Fast_I::Size=Sz;
		inbuf=in;
		_Start_ptr=_End_ptr=_Buf=new char[Sz];
	}
	Fast_Istream::Fast_Istream(const char*in,unsigned int Sz){
		_Ok=1;
		Fast_I::Size=Sz;
		rdbuf(in);
		_Start_ptr=_End_ptr=_Buf=new char[Sz];
	}
	Fast_Istream::Fast_Istream(unsigned int Sz){
		_Ok=1;
		Fast_I::Size=Sz;
		_Start_ptr=_End_ptr=_Buf=new char[Sz];
	}
	void Fast_Istream::rdbuf(const char*File){
		static std::ifstream __In__(File);
		rdbuf(__In__.rdbuf());
	}
	void Get_Char(char& _Val){
		if(_Start_ptr==_End_ptr){
			_Start_ptr=_Buf;
			_End_ptr=_Buf+inbuf->sgetn(_Buf,Size);
		}
		if(_Start_ptr==_End_ptr){
			_Val=-1;
			_Ok=0;
		}else{
			_Val=*_Start_ptr++;
		}
	}
	Fast_Istream&Fast_Istream::operator>>(char&_Val){
		if(_Ok){
			Get_Char(_Val);
			while(_Val==32||_Val==10||_Val==13||_Val==8||_Val==9||_Val==7||_Val==12||_Val==11){
				Get_Char(_Val);
			}
		}
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(char*_Val){
		if(_Ok){
			Get_Char(*_Val);
			while(*_Val==32||*_Val==10||*_Val==13||*_Val==8||*_Val==9||*_Val==7||*_Val==12||*_Val==11){
				Get_Char(*_Val);
			}
			while(*_Val!=32&&*_Val!=10&&*_Val&&*_Val!=-1&&*_Val!=9&&*_Val!=11&&*_Val!=12){
				Get_Char(*++_Val);
			}
			*_Val=0;
			--_Start_ptr;
		}
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(std::string&_Val){
		if(_Ok){
			char c;
			Get_Char(c);
			while(c==32||c==10||c==13||c==8||c==9||c==7||c==12||c==11){
				Get_Char(c);
			}
			for(_Val.clear();c!=32&&c!=10&&c&&c!=-1&&c!=9&&c!=11&&c!=12;Get_Char(c)){
				_Val.push_back(c);
			}
			--_Start_ptr;
		}
		return *this;
	}
	template<typename Typex>
	void Get_Int(Typex&_Val){
		if(_Ok){
			char ch;
			bool _F=0;
			for(Get_Char(ch);(ch<48||ch>57)&&ch!=-1;Get_Char(ch)){
				_F=ch==45;
			}
			for(_Val=0;ch>47&&ch<58&&ch!=-1;Get_Char(ch)){
				_Val=_Val*10+(ch^48);
			}
			if(_F){
				_Val=~_Val+1;
			}
			--_Start_ptr;
		}
	}
	template<typename Typex>
	void Get_Unsigned(Typex&_Val){
		if(_Ok){
			char ch;
			Get_Char(ch);
			while((ch<48||ch>57)&&ch!=-1){
				Get_Char(ch);
			}
			for(_Val=0;ch>47&&ch<58&&ch!=-1;Get_Char(ch)){
				_Val=_Val*10+(ch^48);
			}
			--_Start_ptr;
		}
	}
	template<typename Typex>
	void Get_Double(Typex&_Val){
		if(_Ok){
			char ch;
			bool _F=0;
			for(Get_Char(ch);(ch<48||ch>57)&&ch!=-1;Get_Char(ch)){
				_F=ch==45;
			}
			for(_Val=0;ch>47&&ch<58&&ch!=-1;Get_Char(ch)){
				_Val=_Val*10+(ch^48);
			}
			if(ch==46){
				unsigned long long _Pow=1;
				for(Get_Char(ch);ch>47&&ch<58&&ch!=-1;Get_Char(ch)){
					_Val+=Typex((ch^48)*1.0/(_Pow*=10));
				}
			}
			if(_F){
				_Val=-_Val;
			}
			--_Start_ptr;
		}
	}
	Fast_Istream&Fast_Istream::operator>>(bool&_Val){
		if(_Ok){
			char ch;
			Get_Char(ch);
			while(ch==32||ch==10||ch==13||ch==8||ch==9||ch==7||ch==12||ch==11){
				Get_Char(ch);
			}
			while(ch!=32&&ch!=10&&ch&&ch!=-1&&ch!=9&&ch!=11&&ch!=12){
				_Val|=ch!=48;
				Get_Char(ch);
			}
			--_Start_ptr;
		}
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(short&_Val){
		Get_Int(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(int&_Val){
		Get_Int(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(long&_Val){
		Get_Int(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(long long&_Val){
		Get_Int(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(unsigned short&_Val){
		Get_Unsigned(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(unsigned int&_Val){
		Get_Unsigned(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(unsigned long&_Val){
		Get_Unsigned(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(unsigned long long&_Val){
		Get_Unsigned(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(float&_Val){
		Get_Double(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(double&_Val){
		Get_Double(_Val);
		return *this;
	}
	Fast_Istream&Fast_Istream::operator>>(long double&_Val){
		Get_Double(_Val);
		return *this;
	}
	template<typename Typex,typename...More>
	void Fast_Istream::operator()(Typex&_Val,More&..._More){
		*this>>_Val;
		operator()(_More...);
	}
	void Fast_Istream::pop(){
		char ch;
		Get_Char(ch);
	}
	char Fast_Istream::peek(){
		if(_Start_ptr==_End_ptr){
			_Start_ptr=_Buf;
			_End_ptr=_Buf+inbuf->sgetn(_Buf, Size);
		}
		if(_Start_ptr==_End_ptr){
			_Ok=0;
			return -1;
		}else{
			return *_Start_ptr;
		}
	}
}
namespace Fast_O{
	Fast_Ostream::Fast_Ostream(std::streambuf*out,unsigned int Size){
		buf.reserve(Size);
		outbuf=out;
	}
	Fast_Ostream::Fast_Ostream(const char*File,unsigned int Size){
		buf.reserve(Size);
		rdbuf(File);
	}
	void Fast_Ostream::rdbuf(const char*File){
		static std::ofstream __Out__(File);
		rdbuf(__Out__.rdbuf());
	}
	Fast_Ostream::Fast_Ostream(unsigned int Size){
		buf.reserve(Size);
	}
	void Fast_Ostream::flush(){
		outbuf->sputn(buf.data(),buf.size());
		buf.clear();
	}
	Fast_Ostream::~Fast_Ostream(){
		flush();
	}
	Fast_Ostream&Fast_Ostream::operator<<(char _Val){
		buf.push_back(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(const char*_Val){
		while (*_Val){
			buf.push_back(*_Val++);
		}
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(const std::string&_Val){
		for(auto&&i:_Val){
			buf.push_back(i);
		}
		return *this;
	}
	template<typename Typex>
	void Put_Unsigned(Typex _Val){
		char*_Stack=(char*)malloc(sizeof(Typex)*3);
		unsigned S_top=0;
		while(_Val){
			_Stack[++S_top]=(_Val%10)^48;
			_Val/=10;
		}
		if(!S_top){
			buf.push_back('0');
		}
		while(S_top){
			buf.push_back(_Stack[S_top--]);
		}
		free(_Stack);
	}
	void Put_Int(long long _Val){
		if(_Val<0){
			buf.push_back('-');
			Put_Unsigned(~_Val+1);
		}else{
			Put_Unsigned(_Val);
		}
	}
	Fast_Ostream&Fast_Ostream::operator<<(bool _Val){
		buf.push_back(_Val?'1':'0');
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(short _Val){
		Put_Int(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(int _Val){
		Put_Int(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(long _Val){
		Put_Int(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(long long _Val){
		Put_Int(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(unsigned short _Val){
		Put_Unsigned(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(unsigned int _Val){
		Put_Unsigned(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(unsigned long _Val){
		Put_Unsigned(_Val);
		return *this;
	}
	Fast_Ostream&Fast_Ostream::operator<<(unsigned long long _Val){
		Put_Unsigned(_Val);
		return *this;
	}
	template<typename Typex>
	void Fast_Ostream::endl(const Typex&_Val){
		*this<<_Val<<'\n';
	}
	template<typename Typex,typename...More>
	void Fast_Ostream::endl(const Typex&_Val,const More&..._More){
		*this<<_Val;
		endl(_More...);
	}
	template<typename Typex>
	void Fast_Ostream::operator()(const Typex&_Val){
		*this<<_Val;
	}
	template<typename Typex, typename...More>
	void Fast_Ostream::operator()(const Typex&_Val,const More&..._More){
		*this<<_Val;
		operator()(_More...);
	}
}

高精度计算

高精加

高精加1:

C++
#include<iostream>
#include<cstring>
using namespace std;
char s1[10005],s2[10005];
int a[10005],b[10005],c[10005];
int main(){
	cin>>s1>>s2;
	int la=strlen(s1),lb=strlen(s2);
	//输入
	for(int i=0;i<la;i++){
		a[i]=s1[la-1-i]-'0';
	}
	for(int i=0;i<lb;i++){
		b[i]=s2[lb-1-i]-'0';
	}
	//计算开始
	int lc=max(la,lb),m=0;
	for(int i=0;i<lc;i++){
		c[i]=(m+a[i]+b[i])%10;
		m=(m+a[i]+b[i])/10;
	}
	//特判
	if(m>0){
		c[lc]=m;
		lc++;
	}
	while(c[lc-1]==0&&lc-1>0){
		lc--;

	}
	//输出
	for(int i=lc-1;i>=0;i--){
		cout<<c[i];
	}
}

高精加2:

C++
#include<iostream>
#include<cstring>
using namespace std;
char s1[10005],s2[10005];
int a[10005],b[10005];
int main(){
	cin>>s1>>s2;
	int la=strlen(s1),lb=strlen(s2);
	for(int i=0;i<la;i++){
		a[i]=s1[la-1-i]-'0';
	}
	for(int i=0;i<lb;i++){
		b[i]=s2[lb-1-i]-'0';
	}
	int lc=max(la,lb);
	for(int i=0;i<lc;i++){
		a[i]=a[i]+b[i];
	}
	for(int i=0;i<lc;i++){
		a[i+1]+=a[i]/10;
		a[i]=a[i]%10;
	}
	if(a[lc]>0) lc++;
	while(a[lc-1]==0&&lc-1>0) lc--;
	for(int i=lc-1;i>=0;i--){
		cout<<a[i];
	}
	return 0;
}

高精减

C++
#include<iostream>
#include<cstring>
using namespace std;
int a[210],b[210];
char s1[210],s2[210];
int main(){
	cin>>s1>>s2;
	int l1=strlen(s1),l2=strlen(s2);
	if(strcmp(s1,s2)==0){
		cout<<0;
		return 0;
	}
	if(l1<l2||l1==l2&&strcmp(s1,s2)<0){
		cout<<'-';
		swap(s1,s2);
		swap(l1,l2);
	}
	for(int i=0;i<l1;i++){
		a[i]=s1[l1-1-i]-'0';
	}
	for(int i=0;i<l2;i++){
		b[i]=s2[l2-1-i]-'0';
	}
	for(int i=0;i<l1;i++){
		if(a[i]<b[i]){
			a[i+1]--;
			a[i]+=10;
		}
		a[i]=a[i]-b[i];
	}
	while(l1>0&&a[l1]==0) l1--;
	for(int i=l1;i>=0;i--){
		cout<<a[i];
	}
	return 0;
}

高精乘

C++
//高精度乘单精度
#include<iostream>
#include<cstring>
using namespace std;
int a[210],b[210],x;
char s1[210];
int main(){
	cin>>s1>>x;
	int la=strlen(s1);
	for(int i=0;i<la;i++){
		a[i]=s1[la-i-1]-'0';
	}
	for(int i=0;i<la;i++){
		a[i]=a[i]*x;
	}
	for(int i=0;i<la;i++){
		a[i+1]+=a[i]/10;
		a[i]%=10;
	}
	int x=a[la];
	while(x>0){
		a[la]=x%10;
		x/=10;
		la++;
	}
	for(int i=la-1;i>=0;i--){
		cout<<a[i];
	}
	return 0;
}

高精除

C++
#include<iostream>
#include<cstring>
using namespace std;
char s[210];
int a[210],c[210],r,b;
int main(){
	cin>>s>>b;
	int l=strlen(s);
	for(int i=0;i<l;i++){
		a[i]=s[i]-'0';
	}
	for(int i=0;i<l;i++){
		c[i]=(r*10+a[i])/b;
		r=(a[i]+r*10)%b;
	}
	int x=0;
	while(c[x]==0&&x<x-1) x++;
	for(int i=x;i<l;i++){
		cout<<c[i];
	}
	cout<<' '<<r<<endl;
	return 0;
}

高精幂

C++
#include<iostream>
#include<cstring>
using namespace std;
int a[210],n,x,la;
int main() {
	cin>>x>>n;
	a[0]=1;
	la=1;
	for(int k=1; k<=n; k++) {
		for(int i=0; i<la; i++) {
			a[i]=a[i]*x;
		}
		for(int i=0; i<la; i++) {
			a[i+1]+=a[i]/10;
			a[i]%=10;
		}
		int x=a[la];
		while(x>0) {
			a[la]=x%10;
			x/=10;
			la++;
		}
	}

	for(int i=la-1; i>=0; i--) {
		cout<<a[i];
	}
	return 0;
}

高精阶乘

C++
#include<iostream>
#include<cstring>
using namespace std;
int a[210],n,la;
int main() {
	cin>>n;
	a[0]=1;
	la=1;
	for(int k=1; k<=n; k++) {
		for(int i=0; i<la; i++) {
			a[i]=a[i]*k;
		}
		for(int i=0; i<la; i++) {
			a[i+1]+=a[i]/10;
			a[i]%=10;
		}
		int x=a[la];
		while(x>0) {
			a[la]=x%10;
			x/=10;
			la++;
		}
	}

	for(int i=la-1; i>=0; i--) {
		cout<<a[i];
	}
	return 0;
}