Archives
Trending
Support
Login
clear text
XML
Django
JavaScript
MATLAB
C
C++
C#
Python
SQL
Shell
Bash
Markdown
YAML
JSON
HTML
CSS
PHP
Java
Ruby
Go
Rust
Swift
Kotlin
Arduino
TypeScript
Perl
Autohotkey
Lua
SQF
R
Scala
Haskell
Groovy
Dart
Clojure
VB.NET
Objective-C
PowerShell
Bash
CoffeeScript
Verilog
#include
#include
#include
#include
#include
struct list { list(char _n = 0, short _a = 0, list *_next = NULL) : n(_n), a(_a), next(_next) { } char n; short a; list *next; }; char random(); void sumLists(list* r, list *a, list *b); list* fillList(char index, list* next = NULL); const char N = 10; int main() { time_t t; srand((UINT) time(&t)); list *P = fillList(N), *Q = fillList(N), *R = new list(); sumLists(R, P, Q); return 0 * _getch(); } char random() { char r = rand() % (CHAR_MAX + 1 - CHAR_MIN) + CHAR_MIN; return r == 0 ? random() : r; }; list *fillList(char index, list *next) { return index == 0 ? next : fillList(index - 1, new list(N - index, random(), next)); } void sumLists(list *r, list *a, list *b) { if (a != NULL) { *r = *new list(a->n, a->a + b->a, new list()); sumLists(r->next, a->next, b->next); } }
Mark as private (unlisted)
for 30 minutes
for 6 hours
for 1 day
for 1 week
for 1 month
for 1 year
everlasting (like CCCP)