The dish cries ...
A. The Uncommon husband
Portal: Written ...
D. Calf vs. Small guestTime limit: C/s 1 sec, other languages 2 seconds
Space limitations: C/C + + 32768K, other languages 65536K
64bit IO Format:%lld Link: Https://www.nowcoder.com/acm/contest/75/D Source: Cow-Guest Network title description calf and the small guest play The stone game, they use n a stone to surround a circle, the calf and the small passenger respectively take the stone from therein, Who wins first, each can take one or the next two in a lap, each time is a calf first fetch, please output the winner's name (calf win output Xiaoniu, small guest wins output Xiaoke) (1 2 3 4 Take 2 13 is not adjacent)
Input Description:
Input includes multiple sets of test data
One n (1≤n≤1e9) per set of test data
Output Description:
Each group outputs the winner's name in one line (calf wins output Xiaoniu, small guest wins output Xiaoke)
Example 1 input
23
Output
Xiaoniuxiaoke
Is this problem game?
Code:
1#include <iostream>2#include <cstring>3#include <cstdio>4#include <cmath>5#include <algorithm>6#include <stack>7#include <map>8#include <vector>9#include <queue>Ten#include <Set> One using namespacestd; A Const intinf=1<< -; - Const intmaxn=1e5+Ten; - Const Doubleeps=1e-6; the Const intmod=1e9+7; -typedefLong Longll; - intMain () { - intN; + while(~SCANF ("%d",&N)) { - if(n==1|| n==2) cout<<"Xiaoniu"<<Endl; + Elsecout<<"Xiaoke"<<Endl; A } at return 0; -}
E. Attack! FactorialTime limit: C/s 3 sec, other languages 6 seconds
Space limitations: C/C + + 32768K, other languages 65536K
64bit IO Format:%lld
Links: Https://www.nowcoder.com/acm/contest/75/E
Source: Cow Network topic Description Given an integer n (0≤n≤10000), the factorial input description of n is obtained:
Multiple test data, each test data input a number n
Output Description:
Each group outputs the factorial of N with one line
Example 1 input
123
Output
126
The most recent pile of large numbers, the head big.
Code: Java
1 import Java.math.BigInteger;2 import Java.util.Scanner;3 4 Public classMain {5 Public Static voidMain (String[]args) {6Scanner cin=NewScanner (System.inch);7 intN;8 while(Cin.hasnext ()) {9 BigInteger ans,temp;Tenn=cin.nextint (); OneAns=biginteger.valueof (1); A if(n==0) { -System. out. println (1); - } the Else { - for(intI=1; i<=n;i++) { -temp=biginteger.valueof (i); -ans=ans.multiply (temp); + } -System. out. println (ans); + } A } at } -}
There's another one that's not Java, and I didn't write it.
Code:
1#include <iostream>2#include <cstring>3#include <cstdio>4#include <cmath>5#include <algorithm>6#include <stack>7#include <map>8#include <vector>9#include <queue>Ten#include <Set> One using namespacestd; A Const intinf=1<< -; - Const intmaxn=1e5+Ten; - Const Doubleeps=1e-6; the Const intmod=1e9+7; -typedefLong Longll; - intA[MAXN]; - intMain () { + intN; -Ios::sync_with_stdio (false); Cin.tie (0); Cout.tie (0); + while(cin>>N) { AMemset (A,0,sizeof(a)); ata[0]=1; - intH=1; - for(intI=1; i<=n;i++){ - intres=0; - for(intj=0; j){ - inttemp=a[j]*i+Res; ina[j]=temp%Ten; -res=temp/Ten; to } + while(res) { -a[h++]=res%Ten; theRes/=Ten; * } $ }Panax Notoginseng for(intk=h-1; k>=0; k--) -cout<<A[k]; thecout<<Endl; + } A return 0; the}
G. Flood problemsTime limit: C/s 1 sec, other languages 2 seconds
Space limitations: C/C + + 32768K, other languages 65536K
64bit IO Format:%lld
Links: Https://www.nowcoder.com/acm/contest/75/G
Source: Cow Network topic Description Give a number n, ask 1 to N, how many number is not a multiple of 2 5 11 13. Input Description:
There are multiple sets of inputs
One number per line n,1<=n<=10^18.
Output Description:
The output output of each row is not a multiple of 2 5 11 13.
Example 1 input
15
Output
4
Description
1 3 7 9
Math problem.
Code:
1#include <iostream>2#include <cstring>3#include <cstdio>4#include <cmath>5#include <algorithm>6#include <stack>7#include <map>8#include <vector>9#include <queue>Ten#include <Set> One using namespacestd; A Const intinf=1<< -; - Const intmaxn=1e5+Ten; - Const Doubleeps=1e-6; the Const intmod=1e9+7; -typedefLong Longll; - intMain () { - ll N,ans; + while(~SCANF ("%lld",&N)) { -ans=0; +ans+=n/2+n/5+n/ One+n/ -; Aans-=n/(2*5) +n/(2* One) +n/(2* -) +n/(5* One) +n/(5* -) +n/( One* -); atans+=n/(2*5* One) +n/(2*5* -) +n/(2* One* -) +n/(5* One* -); -ans-=n/(2*5* One* -); -printf"%lld\n", N-ans); - } - return 0; -}
Go and write the next one.
New Ket Network Nowcoder 2018 National multi-school algorithm winter training Camp Practice competition (third session) A. Uncommon Fuf (Sterling formula) D. Calf vs. Small guest E. Attack! Factorial (large number Java) G. Water problem (mathematics)