Skip to main content
Removed invalid answer. Added only correct answer
Source Link
GPS
  • 361
  • 1
  • 6

C (clang), 121133 bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",d;N=(x-(o>43?-y:y))*2/dd;printf("%d",N/2+N%2);} 

Try it online!Try it online!

Spaces are handledThis handles all spaces except between d and N. Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes
[Removed wrong answer that rounds down]

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Spaces are handled except between d and N. Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

C (clang), 133 bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

Try it online!

This handles all spaces except between d and N.

[Removed wrong answer that rounds down]

added 45 characters in body
Source Link
GPS
  • 361
  • 1
  • 6

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Spaces are handled except between d and N. Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Spaces are handled except between d and N. Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 
Added alternate answer
Source Link
GPS
  • 361
  • 1
  • 6

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Result is rounded Down

C (clang), 121 bytes

d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=(!sscanf(a,"%d",&d))?1:d;printf("%d",(x-(o>43?-y:y))/d);} 

Try it online!

Result is rounded Down

Following will round Up >N+0.5 to N+1 @133 Bytes

N,d,y,x,a[9],o;f(*s){sscanf(s," %[0-9N] %c %d = %d",a,&o,&y,&x);d=!sscanf(a,"%d",&d)?1:d;N=(x-(o>43?-y:y))*2/d;printf("%d",N/2+N%2);} 
Source Link
GPS
  • 361
  • 1
  • 6
Loading