You are not logged in. Please login at www.codechef.com to post your questions!

×

output modulo 10^9+7

0
1

i am newbie to codechef problems...can please anyone explain how to write the code in c or C++14 to show output modulo 10^9+7 ..as asked in problems....plz help...if u can show a code problem for it ...it would of great help...i know coding but i just only want to know how to show output in the given format........

asked 26 Aug '17, 23:41

sachin_123yad's gravatar image

2★sachin_123yad
03
accept rate: 0%

edited 27 Aug '17, 23:43

if you could provide a code of a problem as an example for..it would be wonderful

(27 Aug '17, 00:08) sachin_123yad2★

if you can refer to a question involving it in practice problem

(27 Aug '17, 00:14) sachin_123yad2★

if your output is ans you just print ans%1000000007. Make sure you modulo 'ans' for every '+', '-', '*' operation.

link

answered 27 Aug '17, 00:00

sudip_95's gravatar image

4★sudip_95
7556
accept rate: 10%

edited 27 Aug '17, 00:00

i need a code for example..

(27 Aug '17, 00:10) sachin_123yad2★

Hey newbie,

The easiest way is defining it as global variable as

long long mod = 1000000007;

or

define mod 1000000007

or

define mod 1e9+7

then using it in the main or other functions as asked, using some modulo properties

Hope this helps!

link

answered 27 Aug '17, 00:01

sandeep_007's gravatar image

4★sandeep_007
7997
accept rate: 16%

edited 27 Aug '17, 00:02

toggle preview
Preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:

×2,646
×2,286
×325
×243
×191
×58
×23
×8

question asked: 26 Aug '17, 23:41

question was seen: 1,206 times

last updated: 27 Aug '17, 23:43