Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include <iostream>
- #define ULL unsigned long long
- using namespace std;
- int main()
- {
- ifstream f("wisp.in");
- ULL n,k;
- f>>n>>k;
- f.close();
- ULL s=1,sol=1;
- if(n%2)
- for(ULL i=1;i<=n/2+2;i+=2)
- s+=2*(n-i),sol+=s,cout<<s<<'\n',s+=2*(n-i),sol+=s,cout<<s<<'\n';
- else
- {
- for(ULL i=1;i<=n/2;i+=2)
- s+=2*(n-i),sol+=s,cout<<s<<'\n',s+=2*(n-i),sol+=s,cout<<s<<'\n';
- sol+=s+2;
- }
- sol+=n*(k-1); /// Corectez suma pentru k>1
- ofstream g("wisp.out");
- g<<sol<<'\n';
- g.close();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement