SOLVE

LATER

Arithmetic Progressions

Problem

Editorial

Analytics

Fredo recently learnt about Arithmetic Progressions. Seeing his keen interest in the topic, his teacher gave him a task. Fredo is initially given two tables:

1.**first** : It consists of first terms of arithmetic progressions.

2.**diff** : It consists of numbers which can act as the difference between two elements in the arithmetic progression.

The task is:

For every entry **a** in the **first** table, you have to find the smallest number **d** greater than **a** in the **diff** table and then print the $$5^{th}$$ term of the arithmetic progression whose first term is **a** and difference is **d**.

Both the tables have unique entries.

Table : **first**

Field | Type |
---|---|

a | int |

Table: **diff**

Field | Type |
---|---|

d | int |

Field | Type |
---|---|

a | int |

d | int |

Term | int |

**Sample first Table:**

a | |
---|---|

17 | |

18 | |

46 | |

52 | |

62 |

**Sample diff Table:**

d | |
---|---|

22 | |

32 | |

47 | |

53 | |

63 |

a | d | Term |
---|---|---|

17 | 22 | 105 |

18 | 22 | 106 |

46 | 47 | 234 |

52 | 53 | 264 |

62 | 63 | 314 |

Time Limit:
5 sec(s)
for each input file.

Memory Limit:
256 MB

Source Limit:
1024 KB

Marking Scheme:
Marks are awarded when all the testcases pass.

Allowed Languages:
MySQL,
PostgreSQL,
MSSQL,
Oracle Database

Initializing Code Editor...

{"209ec02": "/pagelets/show-submission/sql/arithmetic-progressions/", "209ecd9": "/pagelets/recommended-problems/sql/arithmetic-progressions/", "209ec46": "/pagelets/suggested-problems/sql/arithmetic-progressions/", "209ec77": "/pagelets/problem-author-tester/sql/arithmetic-progressions/", "209eca6": "/pagelets/problems-hint/sql/arithmetic-progressions/"}

{}

realtime.hackerearth.com

80

bab7b41ffa6d8838b8d86a01f5724cbcbda6f1d5

58a29e5cae2309f04b28

/realtime/pusher/auth/